Skip to main content

Events

SharedTree's events are subscribed to via "on" methods which return an unsubscribe function. The returned unsubscribe function should be called when the event subscription is no longer needed.

const unsubscribe = Tree.on(myTreeNode, "nodeChanged", () => {...});

// Later at some point when the event subscription is not needed anymore
unsubscribe();

Whole-Tree Events

TreeView exposes events for the whole tree.

Node-Level Events

The Tree singleton provides APIs for working with nodes including events.

Tree supports two node-level events, subscribed to via Tree.on:

  • nodeChanged fires when one or more properties of node change.
  • treeChanged fires when one or more properties of node or any node in its subtree changes.

See the API docs for each event for further details.