Skip to content

Instantly share code, notes, and snippets.

@AutoSponge
Created January 27, 2018 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AutoSponge/6ce692db4f5f2e5ca974e08900d95a5e to your computer and use it in GitHub Desktop.
Save AutoSponge/6ce692db4f5f2e5ca974e08900d95a5e to your computer and use it in GitHub Desktop.
deep copy of obj in browser
function structuredClone(obj) {
const oldState = history.state
history.replaceState(obj, window.title)
const copy = history.state
history.replaceState(oldState, window.title)
return copy
}
@AutoSponge
Copy link
Author

credit @DasSurma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment