auto-binding

1.0.0 • Public • Published

AutoBind

this package is used to make ES6 classes's method auto binding to it's instance

usage:

import { AutoBind, rcAutoBind } from 'autoBind'
// AutoBind is used for normal ES6 class
// rcAutoBind is specific for react component using ES6 class
 
class SomeClass {
  constructor() {
    AutoBind(this)
    // or bind specific methods 
    AutoBind(this, 'method1', 'method2')
    // or rcAutoBind(this)
    rcAutoBind(this, ...)
  }
 
  method1() {}
  method2() {}
  ...
}

Readme

Keywords

Package Sidebar

Install

npm i auto-binding

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • sirqiao