bind-handler

0.1.0 • Public • Published

bind-handler

NPM version Build Status Test coverage Dependency Status

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

/bind-handler/

    Package Sidebar

    Install

    npm i bind-handler

    Weekly Downloads

    2

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • chentsulin