1.0.0 • Published 5 years ago

@sontx/bindthis v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

bindthis

Binds "this" to all methods of your class

Your mess stuff:

constructor() {
  // .......
  this.method1 = this.method1.bind(this);
  this.method2 = this.method2.bind(this);
  this.method3 = this.method3.bind(this);
  this.method4 = this.method4.bind(this);
  // .......
}

Now, only one line to clear your mess stuff.

constructor() {
  // .......
  bindMethods(this);
  // .......
}