Constructors
constructor
Accessors
nodeCount
root
Methods
addNode
addSubtree
- node: The TreeNode to add as a subtree
findAll
Be mindful about the predicate’s contents. If the tree is very large this operation
can lock the main thread for too long. If you need to execute complex predicates
on large trees, walkAsync is a better candidate.
- predicate: The SearchPredicate to run for each node
- (optional) node: The TreeNode to start at. If not provided, the tree root will be used
findId
Using this method for tree searches is encouraged because it’s accelerated by a
backing NodeMap which brings down searches to just one or more lookups
- id: The id of the node to search for
- (optional) subtreeId: The id of the subtree to search in. If undefined the search will include the entire tree
getAncestors
- node: The node to search ancestors for
getInstances
- subtree: The root subtree id
getRenderTree
null
is returned. The overloaded version with
no argument gets the RenderTree instance for the entire tree, which can never be null.
Parameters
- subtreeId: The root subtree id
isRoot
- node: TreeNode
parse
- node:
{ id: string, raw?: object, atomic?: boolean, children: []}
purge
Purged trees are no longer usable!
- optional subtreeId: The subtree root id. If undefined the whole tree will get purged
removeNode
- node: TreeNode
walk
This function is synchronous and depending on the complexity of your
SearchPredicate and the total
number of nodes, it might block the main thread. For a heavy
SearchPredicate use
walkAsync.
- predicate: SearchPredicate
- optional node: TreeNode
walkAsync
- predicate: SearchPredicate
- optional node: TreeNode
Typedefs
NodeData
- raw: Raw from node creation with parse
- children: Children TreeNodes
- atomic: Whether this node is a complete object (true) or just part of another object (false)
- optional subtreeId: Assigned at runtime used for search acceleration
- optional renderView: Data required for everything rendering related
- optional instanced: Whether this node is an instance