bind-handler
v0.1.0
Published
Bind event handlers to this less verbose
Downloads
2
Readme
bind-handler
Bind event handlers to this less verbose
Install
$ npm install bind-handler
Usage
var bindHandler = require('bind-handler');
class A {
constructor() {
bindHandler(this);
}
handleClick() {
// handler-prefix methods will be auto bound to this
// Just like this.handleClick = this.handleClick.bind(this)
}
otherClick() {
// other methods will not be auto bound to this
}
}
//=>
License
MIT © C.T. Lin