Skip to content

Instantly share code, notes, and snippets.

@zdying
Forked from paulirish/moved.md
Created August 21, 2013 06:02
Show Gist options
  • Save zdying/6290808 to your computer and use it in GitHub Desktop.
Save zdying/6290808 to your computer and use it in GitHub Desktop.
function debugAccess(obj, prop, debugGet){
var origValue = obj[prop];
Object.defineProperty(obj, prop, {
get: function () {
if ( debugGet )
debugger;
return origValue;
},
set: function(val) {
debugger;
return origValue = val;
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment