Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MapEventsRecord<K, V>

Base events record for an IMap<K, V> implementation.

Type Parameters

  • K

  • V

Hierarchy

Index

Properties

Properties

Emitted right after any other event is emitted.

Listen on this if you want to know each time the Collab emits an event (e.g., so you can refresh a display based on its state) without having to listen on each individual event type.

When using [[CRuntime]], note that this event may be emitted multiple times in the middle of a transaction. You typically want to wait to refresh displays until the next [[DocEventsRecord.Change]] event, e.g.:

let isDirty = false;
collab.on("Any", () => { isDirty = true; });
doc.on("Change", () => {
if (isDirty) {
refreshDisplay();
isDirty = false;
}
})

Or, in a React component, use @collabs/react's useCollab.

Delete: MapDeleteEvent<K, V>

Emitted when a key's value is deleted, i.e., the key goes from "present" to "not present".

Set: MapSetEvent<K, V>

Emitted when a key's value is set, i.e., it changes or goes from "not present" to "present".

Note: If the value is itself a mutable Collab, this event is NOT emitted each time the value mutates internally. To detect such changes, instead add your own event listeners on the value when it is constructed (e.g., in [[CMap]]'s valueConstructor constructor arg).

Generated using TypeDoc