Skip to content

Instantly share code, notes, and snippets.

@FuruholmAnton
Created December 1, 2017 20:36
Show Gist options
  • Save FuruholmAnton/46566d351f90525e74874dfc47c48412 to your computer and use it in GitHub Desktop.
Save FuruholmAnton/46566d351f90525e74874dfc47c48412 to your computer and use it in GitHub Desktop.
/**
* Bind methods
* ex. bind(this, 'onClick', 'setHeight');
*
* @param {Object} self
* @param {string} functions
*/
function bind(self, ...functions) {
functions.forEach((name) => {
self[name] = self[name].bind(self);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment