Last active
August 21, 2016 16:49
-
-
Save 1dolinski/9fd428e7f713422cac8d4b6286aa6146 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
| const stampit = require('stampit'); | |
| // stampit(methods, state, enclose); | |
| var testObj = stampit( | |
| // methods | |
| { | |
| delegateMethod: function delegateMethod() { | |
| return 'shared property'; | |
| } | |
| }, | |
| // state | |
| { | |
| instanceProp: 'instance property' | |
| }, | |
| // enclose | |
| function () { | |
| var privateProp = 'private property'; | |
| this.getPrivate = function getPrivate() { | |
| return privateProp; | |
| } | |
| }).create(); | |
| // Why does this return {}? | |
| console.log(testObj); // {} |
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
| const stampit = require('stampit'); | |
| // this works? | |
| testObj = stampit().state({instanceProp: 'instanceProp'}).create(); | |
| console.log(testObj) // {instanceProp: 'instanceProp'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment