feat(overlay-sync): wire OverlaySyncService into DI, IPC and renderer gating
This commit is contained in:
21
tests/mocks/MockAutomationLifecycleEmitter.ts
Normal file
21
tests/mocks/MockAutomationLifecycleEmitter.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
export class MockAutomationLifecycleEmitter {
|
||||
private callbacks: Set<(event: any) => Promise<void> | void> = new Set()
|
||||
|
||||
onLifecycle(cb: (event: any) => Promise<void> | void): void {
|
||||
this.callbacks.add(cb)
|
||||
}
|
||||
|
||||
offLifecycle(cb: (event: any) => Promise<void> | void): void {
|
||||
this.callbacks.delete(cb)
|
||||
}
|
||||
|
||||
async emit(event: any): Promise<void> {
|
||||
for (const cb of Array.from(this.callbacks)) {
|
||||
try {
|
||||
await cb(event)
|
||||
} catch {
|
||||
// ignore subscriber errors in tests
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user