Create the new LinkedTreeList instance, configure the list class.
OptionallinkerClass: typeof TreeLinker
The class used to wrap given data as tree linkers.
ReadonlyclassThe class used to create this instance, so that it can be recognized as valid without an instanceof check.
Whether the inner list has been initialized (it can only be initialized once).
A linker of the list (null when the list is empty); the head is found by walking back from it.
The class used to wrap the data given to this list as tree linkers.
StaticfromConvert an array into a LinkedTreeList instance, return the new instance.
Optionalvalues: any[]
An array of values which will be converted to nodes in this tree-list
OptionallinkerClass: typeof TreeLinker
The class to use for each node
OptionalclassType: any
Provide the type of IsArrayable to use.
Retrieve the first TreeLinker in the list.
Retrieve the last TreeLinker in the list. The end is remembered, so this does not walk the list.
Return the length of the list. It is kept up to date by the list's own methods, so this does not walk the list (call reset() after linkers were changed directly).
Retrieve the innerList used (the list itself, not a copy).
Get the parent of this tree list: the node these linkers are the children of (remembered even while the list is empty), or null for the linkers at the top of a tree.
Set the parent of this tree list: every linker in it gets the node as its parent, and the node gets this list as its children. Linkers added to the list later get this parent too.
The new node to use as the parent for this group of children
Return the root parent of the entire tree.
Iterate over the nodes in this list.
Add a node (or data) after the given (or last) node in the list.
The new node to add to the end of the list
Optionalafter: TreeLinker
The existing last node
Iterate over [index, node] pairs.
Be able to run forEach on this LinkedTreeList to iterate over the TreeLinker Items.
The function to call for-each tree node
OptionalthisArg: LinkedTreeList
Optional, 'this' reference
The list which was iterated.
Initialize the inner list, should only run once.
Give the list of tree-linkers to start in this linked-tree-list.
Insert a new node (or data) after a node. The new node gets the parent of this list.
The existing node as reference, or null to insert at the start of the list
The new node to go after the existing node
Insert a new node (or data) before a node. The new node gets the parent of this list.
The existing node as reference, or null to insert at the end of the list
The new node to go before the existing node
Retrieve a TreeLinker item from this list by numeric index, otherwise return null.
The integer number for retrieving a node by position.
Iterate over the indexes.
Add a node (or data) before the given (or first) node in the list.
The new node to add to the start of the list
Optionalbefore: TreeLinker
The existing first node
Remove a linker from this linked list. The removed node no longer has a parent.
The node we wish to remove (and it will be returned after removal)
The removed node, or null when there was nothing to remove
Refresh all references (the head, the end and the length) by walking the list once, and return the head. The list's own methods keep these up to date, so this is only needed after linkers were changed directly.
Set the children on a parent item.
The TreeLinker node (one of the linkers of this list) that will be the parent of the children
Optionalchildren: LinkedTreeList
The LinkedTreeList which has the child nodes to use, or null to remove the children of the item
Iterate over the nodes.
A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than the linkers that hold them.