Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33c8c6f
commit b47b6d4
Showing
4 changed files
with
67 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function is(value, type) { | ||
return {}.toString.call(value) === `[object ${type}]` | ||
} | ||
|
||
function isRegExp (value) { | ||
return is(value, 'ExgExp') | ||
} | ||
|
||
function isDate (value) { | ||
return is(value, 'Date') | ||
} | ||
|
||
function isPromise (value) { | ||
return is(value, 'Promise') | ||
} | ||
|
||
function isArray (value) { | ||
return Array.isArray(value) | ||
} | ||
|
||
function clone (value) { | ||
if (typeof value !== 'object') { | ||
return value | ||
} | ||
if (isArray(value)) { | ||
return value.map(x => clone(x)) | ||
} | ||
if (isPromise(value)) { | ||
return value | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title></title> | ||
</head> | ||
<body> | ||
<script src="./main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
window.addEventListener('storage', e => { | ||
console.log(e) | ||
document.body.style.background = 'black' | ||
}) | ||
|
||
localStorage.a = 3 | ||
localStorage.setItem('b', 8) | ||
|
||
setTimeout(() => { | ||
localStorage.a = 4 | ||
localStorage.setItem('b', Math.random()) | ||
}, 3000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b47b6d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: