Skip to main content

Tree Interface

Provides various functions for interacting with TreeNodes.

This API is reserved for internal system use and should not be imported directly. It may change at any time without notice.

For more information about our API support guarantees, see here.

Sealed

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 Tree extends TreeNodeApi

Extends: TreeNodeApi

Remarks

This type should only be used via the Tree export.

Properties

Property Modifiers Type Description
runTransaction readonly RunTransaction Run a transaction.

Methods

Method Return Type Description
contains(node, other) boolean Check if the subtree defined by node contains other.

Property Details

runTransaction

Run a transaction.

This API is reserved for internal system use and should not be imported directly. It may change at any time without notice.

For more information about our API support guarantees, see here.

Sealed

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 runTransaction: RunTransaction;

Type: RunTransaction

Method Details

contains

Check if the subtree defined by node contains other.

This API is reserved for internal system use and should not be imported directly. It may change at any time without notice.

For more information about our API support guarantees, see here.

Sealed

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
contains(node: TreeNode, other: TreeNode): boolean;
Remarks

This includes direct and indirect children: as long as node is an ancestor of other (occurs in its parentage chain), this returns true, regardless of the number of levels of the tree between.

node is considered to contain itself, so the case where node === other returns true.

This is handy when checking if moving node into other would create a cycle and would thus be invalid.

This check walks the parents of other looking for node, and thus runs in time proportional to the depth of child in the tree.

Parameters

Parameter Type Description
node TreeNode
other TreeNode

Returns

true if other is an inclusive descendant of node, and false otherwise.

Return type: boolean