feat(companion): add event surface snapshot helper
This commit is contained in:
@@ -53,6 +53,12 @@ export interface PendingWorkSnapshot {
|
||||
hasPendingWork: boolean;
|
||||
}
|
||||
|
||||
export interface EventSurfaceSnapshot {
|
||||
knownEventNames: CompanionEventName[];
|
||||
eventSubscriptionCount: number;
|
||||
pendingEventWaitCount: number;
|
||||
}
|
||||
|
||||
export type CompanionEventHandler = (event: string, data: unknown) => void;
|
||||
export type CompanionTypedEventHandler<TData = unknown> = (data: TData) => void;
|
||||
export type CompanionEventPredicate<TData = unknown> = (data: TData) => boolean;
|
||||
@@ -338,6 +344,14 @@ export class CompanionRuntimeClient {
|
||||
};
|
||||
}
|
||||
|
||||
getEventSurfaceSnapshot(): EventSurfaceSnapshot {
|
||||
return {
|
||||
knownEventNames: this.listKnownEventNames(),
|
||||
eventSubscriptionCount: this.eventSubscriptionCount,
|
||||
pendingEventWaitCount: this.pendingEventWaitCount,
|
||||
};
|
||||
}
|
||||
|
||||
async connect(): Promise<void> {
|
||||
if (this.connected) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user