bind.methods

0.1.0 • Public • Published

bind.methods

Readme

Bind selected class methods from constructor

Usage

const bind = bindMethods('bind.methods');

class Example {
  constructor() {
    bind(this, 'onClick');
    // bind(this, ['onDragStart', 'onDragEnd']);
    // bind(this); // bind all class methods
  }
  onClick() {
    console.log(this);
  }
}

const example = new Example();

example.onClick.call(123456); // class Example

License

Library bind.methods is licensed under MIT.

Readme

Keywords

Package Sidebar

Install

npm i bind.methods

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • lestad