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

Function createEditorSession

packages/sdk/examples/react-embed.ts:19–31  ·  view source on GitHub ↗
(html: string)

Source from the content-addressed store, hash-verified

17// Typically called once in useEffect(() => { createEditorSession(html).then(setComp) }, [])
18
19export async function createEditorSession(html: string): Promise<Composition> {
20 const persist = createMemoryAdapter();
21
22 const comp = await openComposition(html, { persist });
23
24 // Persist failures surface as events, never fatal exceptions.
25 comp.on("persist:error", ({ error }) => {
26 console.error(`Auto-save failed: ${error.message}`);
27 // In a real app: show a toast notification
28 });
29
30 return comp;
31}
32
33// ── useSyncExternalStore integration ─────────────────────────────────────────
34// React 18+ pattern:

Callers

nothing calls this directly

Calls 4

createMemoryAdapterFunction · 0.85
openCompositionFunction · 0.85
errorMethod · 0.80
onMethod · 0.65

Tested by

no test coverage detected