feat(companion): return cancelPendingEventWaits count
This commit is contained in:
@@ -435,8 +435,8 @@ export class CompanionRuntimeClient {
|
||||
this.rejectEventWaits(new Error('Event subscriptions cleared'));
|
||||
}
|
||||
|
||||
cancelPendingEventWaits(reason = 'Event waits cancelled'): void {
|
||||
this.rejectEventWaits(new Error(reason));
|
||||
cancelPendingEventWaits(reason = 'Event waits cancelled'): number {
|
||||
return this.rejectEventWaits(new Error(reason));
|
||||
}
|
||||
|
||||
subscribeEvent<TData = unknown>(
|
||||
@@ -925,11 +925,13 @@ export class CompanionRuntimeClient {
|
||||
this.pending.clear();
|
||||
}
|
||||
|
||||
private rejectEventWaits(error: Error): void {
|
||||
private rejectEventWaits(error: Error): number {
|
||||
const cancelled = this.pendingEventWaits.size;
|
||||
for (const cancel of this.pendingEventWaits) {
|
||||
cancel(error);
|
||||
}
|
||||
this.pendingEventWaits.clear();
|
||||
return cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user