Automatically bind all functions of a class to itself.
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'
$ npm install itsjoekent-bind
$ npm install
$ npm test
Very opinionated ™️ suite of NPM packages I use to quickly build cool shit. https://github.com/itsjoekent/packages
MIT