-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
CountingGovernors should have idle listeners. addIdleListener registers a callback and removeIdleListener unregisters it.
addIdleListener(cb: () => void) {
this.#idleListeners.push(cb);
}
removeIdleListener(cb: () => void) {
const idx = this.#idleListeners.indexOf(cb);
if (idx >= 0) {
this.#idleListeners.splice(idx, 1);
}
}
#notifyIdleListeners() {
for (const cb of this.#idleListeners) {
try {
cb();
} catch {}
}
}Whenever a token is disposed and there are no more active tokens, all of the currently registered callbacks should be called.
Metadata
Metadata
Assignees
Labels
No labels