SelectionSetEvent Type

SelectionSetEvent = SelectAddEvent | SelectRemoveEvent | SelectReplaceEvent

Payload sent to onChanged event listeners to describe how the contents of the set have changed. The type property of the event serves as a type assertion. For example, the following code will output the added and/or removed Ids:

processSelectionSetEvent(ev: SelectionSetEvent): void {
  if (SelectionSetEventType.Add === ev.type || SelectionSetEventType.Replace === ev.type)
    console.log("Added " + (ev.additions.elements?.size ?? 0) + " elements");

  if (SelectionSetEventType.Add !== ev.type)
    console.log("Removed " + (ev.removals.elements?.size ?? 0) + " elements");
}

Defined in

Last Updated: 18 January, 2025