kibana-123
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
20 lines (16 loc) • 416 B
JavaScript
export default class Binder {
constructor() {
this.disposal = [];
}
on(emitter, ...args) {
const on = emitter.on || emitter.addListener;
const off = emitter.off || emitter.removeListener;
on.apply(emitter, args);
this.disposal.push(() => off.apply(emitter, args));
}
destroy() {
const destroyers = this.disposal;
this.disposal = [];
destroyers.forEach(fn => fn());
}
}