UNPKG

homebridge-tessie

Version:

Connect Homebridge to your Tessie account.

20 lines 565 B
export class EventEmitter { events = new Map(); // Can't really make this typesafe. on(type, listener) { const { events } = this; const listeners = events.get(type); if (listeners) { listeners.add(listener); } else { events.set(type, new Set([listener])); } } off(type, listener) { this.events.get(type)?.delete(listener); } emit(type, ...args) { this.events.get(type)?.forEach((listener) => listener(...args)); } } //# sourceMappingURL=event.js.map