Skip to content

Instantly share code, notes, and snippets.

@LuisMayo
Created November 18, 2019 05:17
Show Gist options
  • Save LuisMayo/c149ee6aaef64904d0ce966086fd0e8d to your computer and use it in GitHub Desktop.
Save LuisMayo/c149ee6aaef64904d0ce966086fd0e8d to your computer and use it in GitHub Desktop.
debugVariableWriting = function (object, propertyName) {
object['_' + propertyName] = object[propertyName]
Object.defineProperty(object, propertyName, {
get: function() {
console.log('get!');
return this['_' + propertyName];
},
set: function(val) {
debugger;
this['_' + propertyName] = val;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment