Skip to content

Instantly share code, notes, and snippets.

@rkeVader
Created March 12, 2019 12:31
Show Gist options
  • Select an option

  • Save rkeVader/91a244187d60e6328bcc56b8ecde39e3 to your computer and use it in GitHub Desktop.

Select an option

Save rkeVader/91a244187d60e6328bcc56b8ecde39e3 to your computer and use it in GitHub Desktop.

Revisions

  1. rkeVader created this gist Mar 12, 2019.
    25 changes: 25 additions & 0 deletions ObjectProperties.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    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;
    }
    );
    */