TreeApi Interface

Packages > @fluidframework/tree > InternalTypes > TreeApi

Provides various functions for interacting with TreeNode s.

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 .

Signature

/** @sealed */
export interface TreeApi extends TreeNodeApi

Extends: TreeNodeApi

Remarks

This type should only be used via the public Tree export.

Properties

Property Alerts Modifiers Type Description
runTransaction System readonly RunTransaction Run a transaction.

Methods

Method Alerts Return Type Description
contains(node, other) System 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 .

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 .

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 thus is 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