@mocanvas/editor · function

createSessionStateSnapshotSignal

declare function createSessionStateSnapshotSignal(store: EditorStore): Signal<TLSessionStateSnapshot | null>

A signal of the store's current session state.

Reactive, so a host persisting the session can react on it and write whenever it actually changes, instead of polling or hooking every command that might have moved the camera.

Answers null before the store has an instance record — i.e. before the editor has started — because "no session yet" and "an empty session" would otherwise be indistinguishable, and persisting the second over a good saved one loses the person's place.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.