feat(companion): add generic platform event passthroughs
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import type {
|
||||
CompanionEventEnvelope,
|
||||
CompanionEventHandler,
|
||||
CanvasClearResult,
|
||||
CanvasDeleteResult,
|
||||
CanvasGetResult,
|
||||
@@ -245,6 +247,21 @@ export class MacOSCompanionClient {
|
||||
return this.runtime.waitForAgentStream(options);
|
||||
}
|
||||
|
||||
subscribeEvents(handler: CompanionEventHandler): () => void {
|
||||
return this.runtime.subscribeEvents(handler);
|
||||
}
|
||||
|
||||
waitForAnyEvent<TData = unknown>(
|
||||
eventNames: readonly string[],
|
||||
options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: (event: string, data: TData) => boolean;
|
||||
signal?: AbortSignal;
|
||||
},
|
||||
): Promise<CompanionEventEnvelope<TData>> {
|
||||
return this.runtime.waitForAnyEvent(eventNames, options);
|
||||
}
|
||||
|
||||
waitForAgentTyping<TData = unknown>(options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
@@ -438,6 +455,21 @@ export class IOSCompanionClient {
|
||||
return this.runtime.waitForAgentStream(options);
|
||||
}
|
||||
|
||||
subscribeEvents(handler: CompanionEventHandler): () => void {
|
||||
return this.runtime.subscribeEvents(handler);
|
||||
}
|
||||
|
||||
waitForAnyEvent<TData = unknown>(
|
||||
eventNames: readonly string[],
|
||||
options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: (event: string, data: TData) => boolean;
|
||||
signal?: AbortSignal;
|
||||
},
|
||||
): Promise<CompanionEventEnvelope<TData>> {
|
||||
return this.runtime.waitForAnyEvent(eventNames, options);
|
||||
}
|
||||
|
||||
waitForAgentTyping<TData = unknown>(options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
@@ -629,6 +661,21 @@ export class AndroidCompanionClient {
|
||||
return this.runtime.waitForAgentStream(options);
|
||||
}
|
||||
|
||||
subscribeEvents(handler: CompanionEventHandler): () => void {
|
||||
return this.runtime.subscribeEvents(handler);
|
||||
}
|
||||
|
||||
waitForAnyEvent<TData = unknown>(
|
||||
eventNames: readonly string[],
|
||||
options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: (event: string, data: TData) => boolean;
|
||||
signal?: AbortSignal;
|
||||
},
|
||||
): Promise<CompanionEventEnvelope<TData>> {
|
||||
return this.runtime.waitForAnyEvent(eventNames, options);
|
||||
}
|
||||
|
||||
waitForAgentTyping<TData = unknown>(options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
|
||||
Reference in New Issue
Block a user