Skip to content

chentsulin/bind-handler

Repository files navigation

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

About

Bind event handlers to this less verbose

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published