Created
March 12, 2019 12:31
-
-
Save rkeVader/91a244187d60e6328bcc56b8ecde39e3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function CreateProperty(O, P, Getter, Setter) { | |
Object.defineProperty(O, P, { | |
get: Getter, | |
set: Setter | |
}); | |
} // CreateProperty | |
// SAMPLE USAGE | |
/* | |
CreateProperty( | |
testclass.prototype, | |
'TestProp', | |
function() { | |
console.log('TestProp Getter Called'); | |
return this._testProp; | |
}, | |
function(value) { | |
console.log('TestProp Setter Called With [' + value + ']'); | |
this._testProp = value; | |
} | |
); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment