Created
November 6, 2016 07:33
-
-
Save gbhasha/c1e8d6c194120bfd52a094490d80eb16 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
function es6BindAll(context, methodNames) { | |
methodNames.map(function(methodName) { | |
context[methodName] = context[methodName].bind(context); | |
}); | |
}; | |
// Usage: | |
// es6BindAll(this, ["method1", "method2", "methodX"]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment