Skip to content

Instantly share code, notes, and snippets.

@gbhasha
Created November 6, 2016 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbhasha/c1e8d6c194120bfd52a094490d80eb16 to your computer and use it in GitHub Desktop.
Save gbhasha/c1e8d6c194120bfd52a094490d80eb16 to your computer and use it in GitHub Desktop.
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