weasel API - v0.8.0
    Preparing search index...

    Interface UseSceneOptions<TData, TLayer, TPose>

    interface UseSceneOptions<TData, TLayer extends string, TPose = RectPose> {
        coalesceWindowMs?: number;
        generateId?: () => NodeId;
        getActiveJournal?: () => Journal | null;
        historyLimit?: number;
        initial?: readonly AddNodeSpec<TData, TLayer, TPose>[];
        ops?: Readonly<Record<string, RegisteredOp<unknown>>>;
        registry?: SceneRegistry<TPose>;
        systemLayers: readonly SystemLayerSpec<TLayer>[];
    }

    Type Parameters

    • TData
    • TLayer extends string
    • TPose = RectPose
    Index

    Properties

    coalesceWindowMs?: number

    Window (ms) within which consecutive same-shaped mutations merge into the previous undo entry (matching per-op coalesce keys — e.g. repeated setPose on the same node, or repeated applyBatch calls whose ops carry matching coalesceKey multisets). 0 (default) disables coalescing: every mutation is a discrete undo entry. Undo of a coalesced entry returns to the state before the first merged mutation; redo restores the latest. scene.batch entries never coalesce.

    generateId?: () => NodeId
    getActiveJournal?: () => Journal | null

    When supplied, scene.applyOps(ops, label) consults this on every call. If it returns a non-null Journal, ops are routed to the journal's applyBatch instead of recording a new parent-history entry. The journal drives adapter mutation internally (via op.apply(adapter)), so the scene state changes as normal; only the history tracking differs.

    The accessor is called on every applyOps invocation so the caller can swap the active journal in and out by updating the closure's reference (e.g., an app's mode machine holds let activeJournal: Journal | null and the accessor reads that variable).

    When the accessor isn't known at scene-construction time (typical for mode machines that depend on scene.history), pass nothing here and wire it after construction via scene.setActiveJournalAccessor(fn).

    historyLimit?: number
    initial?: readonly AddNodeSpec<TData, TLayer, TPose>[]
    ops?: Readonly<Record<string, RegisteredOp<unknown>>>
    registry?: SceneRegistry<TPose>

    Per-scene registry for non-serializable function fields (clipFromPose, etc.). Required only when serializing/deserializing scenes that use function fields.

    systemLayers: readonly SystemLayerSpec<TLayer>[]