• Public
  • Public/Protected
  • All

Interface CollabEventsRecord

A record of events emitted by a Collab, mapping from event name to event type.

Typically, a Collab emits an event whenever its local state changes. The event should use a Collab-specific name and type to completely describe the change. Note that different replicas may see different events: the events describe the local view of the changes.

Events records are only intended for type bookkeeping, not for use by literal objects or classes.





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) {
isDirty = false;

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

Generated using TypeDoc