Created
April 5, 2018 15:19
-
-
Save kwdowicz/74f37afa5c4f85ce7251268fd5530613 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(prop in this) { | |
// creating callbacks for each property | |
var _prop = prop + 'Callback'; | |
this[_prop] = undefined; | |
// creating custom setters for each property | |
var _set = 'set' + prop; | |
this[_set] = new Function('value',`console.log('setting name: ' + value); if(value !== this.${prop}) { this.${prop} = value; this.${_set}(value); }`); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment