TreeAlpha Interface
Extensions to Tree and TreeBeta which are not yet stable.
For more information about our API support guarantees, see here.
This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.
Signature
/** @sealed */
export interface TreeAlpha
Remarks
Use via the TreeAlpha singleton.
Properties
Property | Alerts | Modifiers | Type | Description |
---|---|---|---|---|
identifier | Alpha |
readonly |
TreeIdentifierUtils | APIs for creating, converting, and retrieving identifiers. |
Methods
Method | Alerts | Return Type | Description |
---|---|---|---|
branch(node) | Alpha |
TreeBranch | undefined | Retrieve the branch, if any, for the given node. |
child(node, key) | Alpha |
TreeNode | TreeLeafValue | undefined | Gets the child of the given node with the given property key if a child exists under that key. |
children(node) | Alpha |
Iterable<[propertyKey: string | number, child: TreeNode | TreeLeafValue]> | Gets the children of the provided node, paired with their property keys under the node. |
create(schema, data) | Alpha |
Unhydrated<TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeNode | TreeLeafValue | undefined> | Construct tree content that is compatible with the field defined by the provided schema . |
exportCompressed(tree, options) | Alpha |
JsonCompatible<IFluidHandle> | Export the content of the provided tree in a compressed JSON compatible format. |
exportConcise(node, options) | Alpha |
ConciseTree | Copy a snapshot of the current version of a TreeNode into a ConciseTree. |
exportConcise(node, options) | Alpha |
ConciseTree | undefined | Copy a snapshot of the current version of a TreeNode into a ConciseTree, allowing undefined. |
exportVerbose(node, options) | Alpha |
VerboseTree | Copy a snapshot of the current version of a TreeNode into a JSON compatible plain old JavaScript Object (except for IFluidHandles). Uses the VerboseTree format, with an explicit type on every node. |
importCompressed(schema, compressedData, options) | Alpha |
Unhydrated<TreeFieldFromImplicitField<TSchema>> | Import data encoded by exportCompressed(tree, options). |
importConcise(schema, data) | Alpha |
Unhydrated<TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeNode | TreeLeafValue | undefined> | Less type safe version of create(schema, data), suitable for importing data. |
importVerbose(schema, data, options) | Alpha |
Unhydrated<TreeFieldFromImplicitField<TSchema>> | Construct tree content compatible with a field defined by the provided schema . |
key2(node) | Alpha |
string | number | undefined | The key of the given node under its parent. |
Property Details
identifier
APIs for creating, converting, and retrieving identifiers.
For more information about our API support guarantees, see here.
This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.
Signature
readonly identifier: TreeIdentifierUtils;
Type: TreeIdentifierUtils
Method Details
branch
Retrieve the branch, if any, for the given node.
For more information about our API support guarantees, see here.
This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.
Signature
branch(node: TreeNode): TreeBranch | undefined;
Remarks
If the node has already been inserted into the tree, this will return the branch associated with that node's view. Otherwise, it will return undefined
(because the node has not yet been inserted and is therefore not part of a branch or view).
This does not fork a new branch, but rather retrieves the _existing_ branch for the node. To create a new branch, use e.g. `myBranch.fork()`.
Parameters
Parameter | Type | Description |
---|---|---|
node | TreeNode | The node to query |
Returns
Return type: TreeBranch | undefined