Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Forked from dmethvin/gist:1676346
Created January 27, 2012 22:05
Show Gist options
  • Save rwaldron/1691179 to your computer and use it in GitHub Desktop.
Save rwaldron/1691179 to your computer and use it in GitHub Desktop.
Breakpoint on access to a property
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