Skip to content

Function: serialize() ​

ts
function serialize(viewer): ViewerStateV2;

Defined in: serialization/StateSerializer.ts:25

Serialize a NeuroSurfaceViewer into a portable JSON state object.

The viewer is accessed via duck-typing to avoid circular imports. Components that implement toStateJSON() are preferred; otherwise the serializer reads public fields directly.

Parameters ​

viewer ​

any

Returns ​

ViewerStateV2

Released under the MIT License.