MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / TestPreviewAdapter

Class TestPreviewAdapter

packages/sdk/src/session.test.ts:17–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15`.trim();
16
17class TestPreviewAdapter implements PreviewAdapter {
18 private selectionHandlers: Array<(ids: string[]) => void> = [];
19
20 // fallow-ignore-next-line code-duplication
21 elementAtPoint(_x: number, _y: number, _opts?: { atTime?: number }): ElementAtPointResult | null {
22 return null;
23 }
24
25 applyDraft(_id: string, _props: DraftProps): void {
26 // Test adapter tracks selection only.
27 }
28
29 commitPreview(): void {
30 // Test adapter tracks selection only.
31 }
32
33 cancelPreview(): void {
34 // Test adapter tracks selection only.
35 }
36
37 select(ids: string[], _opts?: { additive?: boolean }): void {
38 this.emitSelection(ids);
39 }
40
41 on(_event: "selection", handler: (ids: string[]) => void): () => void {
42 this.selectionHandlers.push(handler);
43 return () => {
44 this.selectionHandlers = this.selectionHandlers.filter((h) => h !== handler);
45 };
46 }
47
48 emitSelection(ids: readonly string[]): void {
49 const snapshot = [...ids];
50 for (const handler of this.selectionHandlers) {
51 handler([...snapshot]);
52 }
53 }
54
55 listenerCount(): number {
56 return this.selectionHandlers.length;
57 }
58}
59
60// ─── Preview selection bridge ────────────────────────────────────────────────
61

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected