Packages > @fluidframework/tree > TreeChangeEvents

TreeChangeEvents Interface

A collection of events that can be emitted by a TreeNode .

Signature

/** @sealed */
export interface TreeChangeEvents

Methods

Method Return Type Description
nodeChanged() void

Emitted by a node after a batch of changes has been applied to the tree, if a change affected the node, where a change is:

- For an object node, when the value of one of its properties changes (i.e., the property's value is set to something else, including undefined).

- For an array node, when an element is added, removed, or moved.

- For a map node, when an entry is added, updated, or removed.

treeChanged() void Emitted by a node after a batch of changes has been applied to the tree, when something changed anywhere in the subtree rooted at it.

Method Details

nodeChanged

Emitted by a node after a batch of changes has been applied to the tree, if a change affected the node, where a change is:

  • For an object node, when the value of one of its properties changes (i.e., the property’s value is set to something else, including undefined).

  • For an array node, when an element is added, removed, or moved.

  • For a map node, when an entry is added, updated, or removed.

Signature

nodeChanged(): void;

Remarks

This event is not emitted when:

  • Properties of a child node change. Notably, updates to an array node or a map node (like adding or removing elements/entries) will emit this event on the array/map node itself, but not on the node that contains the array/map node as one of its properties.

  • The node is moved to a different location in the tree or removed from the tree. In this case the event is emitted on the _parent_ node, not the node itself.

For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in the client that made the original edit.

When it is emitted, the tree is guaranteed to be in-schema.

treeChanged

Emitted by a node after a batch of changes has been applied to the tree, when something changed anywhere in the subtree rooted at it.

Signature

treeChanged(): void;

Remarks

This event is not emitted when the node itself is moved to a different location in the tree or removed from the tree. In that case it is emitted on the _parent_ node, not the node itself.

The node itself is part of the subtree, so this event will be emitted even if the only changes are to the properties of the node itself.

For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in the client that made the original edit.

When it is emitted, the tree is guaranteed to be in-schema.