Skip to main content

Node Types

Data on a SharedTree is stored as a node of one of the types described below.

Leaf Nodes

A leaf holds an atomic value. The available leaf types are:

  • boolean: a JavaScript boolean.
  • number: a JavaScript number, but does not support -0 (normalized to 0), NaN, or Infinity (normalized to null where allowed).
  • string: a JavaScript string, but does not support unpaired UTF-16 surrogate pairs.
  • null: JavaScript null.
  • FluidHandle: a handle to a Fluid DDS or Data Object. See Handles.

TreeNodes

There are multiple kinds of TreeNode, each of which manage and expose their children differently.

Object Nodes

An object node has zero or more named child fields exposed as properties. Different object nodes in the same tree can have different schemas. The schema specifies whether each property is required, optional, or an identifier, and which node types are allowed (e.g., a property could allow number or string).

Map Nodes

A map node holds zero or more string-keyed values, similar to a JavaScript Map with string keys. The schema specifies which node types are allowed as values; all keys share the same allowed types and there is no way to constrain individual key names or the number of entries.

Array Nodes

An array node is an indexed sequence of zero or more values, like a JavaScript array. The schema specifies which node types are allowed as items.