UNPKG

libre-routing

Version:

This library was generated with [Nx](https://nx.dev).

18 lines 545 B
export class Dispatcher { constructor() { this.callbacks = {}; } fire(event, data) { this.getEventCallbacks(event).forEach((callback) => callback(data)); } on(event, callback) { this.callbacks[event] = [...this.getEventCallbacks(event), callback]; } off(event, callback) { this.callbacks[event] = this.getEventCallbacks(event).filter((c) => c !== callback); } getEventCallbacks(event) { return this.callbacks[event] || []; } } //# sourceMappingURL=dispatcher.js.map