sindresorhus/emittery
The issue has been solved
Add convenience method to bind Emittery methods to own instance #30
sindresorhus posted onGitHub
EventEmitter
in Node.js is usually subclassed, but I don't like this pattern, and I don't think we should recommend it. It's better to have an internal Emittery instance and just explicitly expose some of the methods.
We could make this even easier, by providing a convenience method to bind the Emittery method to the instance:
class Foo {
constructor() [
this.emitter = new Emittery();
this.emitter.bindMethods(this, ['on', 'off']);
]
}
The above would quickly expose the on
and off
methods, but nothing else.