1.0.1 • Published 8 years ago

itsjoekent-bind v1.0.1

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

itsjoekent-bind

Automatically bind all functions of a class to itself.

Usage

const bind = require('itsjoekent-bind');

class Example {
  constructor() {
    this.ref = 'ok';

    bind.all(this, Example);
  }

  howdy(cb) {
    return setTimeout(() => cb(this.ref), 0);
  }
}

new Example().howdy(console.log); // 'ok'

Installation

$ npm install itsjoekent-bind

Tests

$ npm install
$ npm test

Apart of itsjoekent/packages

Very opinionated ™️ suite of NPM packages I use to quickly build cool shit. https://github.com/itsjoekent/packages

License

MIT