Documentation
    Preparing search index...

    Interface SerializeSceneOptions

    Options for serializeScene.

    interface SerializeSceneOptions {
        nodeDataOf?: (node: Node) => JsonValue | undefined;
        nodeTypeOf?: (node: Node) => string | undefined;
        unknownComponents?: UnknownComponentPolicy;
    }
    Index
    nodeDataOf?: (node: Node) => JsonValue | undefined

    The node's subclass state, written to SceneNodeDocument.data and handed back verbatim to InstantiateSceneOptions.nodeFactory (2026-08-06).

    Return undefined — as this option does for every node when it is omitted — and the node carries no data at all, so a document written without it is byte-identical to one written before the field existed. Anything else must be representable JSON; validateSceneDocument refuses the rest, naming the node.

    The pair with SerializeSceneOptions.nodeTypeOf: nodeTypeOf says what class the node was, nodeDataOf says what state it held, and the factory needs both to rebuild it.

    nodeTypeOf?: (node: Node) => string | undefined

    The document type for a node this package has no name for — an application's own Node subclass. Returning undefined falls back to the built-in Scene / Group names, and a node with neither is a FourError.

    unknownComponents?: UnknownComponentPolicy

    What to do with a component whose type has no registered serializer (2026-08-06, A-15).

    "throw" (the default) refuses the save: an unserializable component is state that would be gone after the round trip, and a save that quietly loses state is worse than one that fails. "skip" drops it — the right choice for a writer that deliberately carries the hierarchy only, and the reason the choice is the caller's.

    The mirror of InstantiateSceneOptions.unknownComponents, same spelling and same default, so a program that has to be lenient says so once on each side rather than discovering the asymmetry.