class Subscribable { constructor() { this.listeners = new Set(); this.subscribe = this.subscribe.bind(this); } subscribe(listener) { const identity = { listener }; this.listeners.add(identity); this.onSubscribe(); return () => { this.listeners.delete(identity); this.onUnsubscribe(); }; } hasListeners() { return this.listeners.size > 0; } onSubscribe() {// Do nothing } onUnsubscribe() {// Do nothing } } export { Subscribable }; //# sourceMappingURL=subscribable.mjs.map