mirror of
https://github.com/hanzoai/agency.git
synced 2026-11-02 19:13:28 +00:00
26 lines
522 B
Plaintext
26 lines
522 B
Plaintext
// src/subscribable.ts
|
|
var Subscribable = class {
|
|
constructor() {
|
|
this.listeners = /* @__PURE__ */ new Set();
|
|
this.subscribe = this.subscribe.bind(this);
|
|
}
|
|
subscribe(listener) {
|
|
this.listeners.add(listener);
|
|
this.onSubscribe();
|
|
return () => {
|
|
this.listeners.delete(listener);
|
|
this.onUnsubscribe();
|
|
};
|
|
}
|
|
hasListeners() {
|
|
return this.listeners.size > 0;
|
|
}
|
|
onSubscribe() {
|
|
}
|
|
onUnsubscribe() {
|
|
}
|
|
};
|
|
export {
|
|
Subscribable
|
|
};
|
|
//# sourceMappingURL=subscribable.js.map |