Skip to content

Instantly share code, notes, and snippets.

@rndme
Created February 23, 2016 08:30
Show Gist options
  • Save rndme/94f6154f5acd741f34f1 to your computer and use it in GitHub Desktop.
Save rndme/94f6154f5acd741f34f1 to your computer and use it in GitHub Desktop.
Object.defineProperty(window, "__", {set: Object.freeze});
// ex usage:
var state= __={
a: 1,
b: 3,
c: __=[1,2,3, __={ z: 7 } ]
};
// try to mutate:
state.c[1]=3424;
state.c[3].z=2434;
console.log(state); // did anything change? (No)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment