Last active
August 29, 2015 14:10
-
-
Save MoOx/cc15000ff93305b926ce to your computer and use it in GitHub Desktop.
bind an api
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
createClass({ | |
commonApi: { | |
method: function() { | |
// this will be the instance | |
} | |
}, | |
getInitialState() { | |
this.api = {} | |
Object.keys(this.commonApi).forEach(function(method) { | |
this.api[method] = this.commonApi[method].bind(this) | |
}) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment