• Public
  • Public/Protected
  • All



Type Aliases

CollabID<C>: { collabIDPath: string[] }

A replica-independent ID for a Collab.

A CollabID refers to a Collab in a way that makes sense across replicas: you can send a CollabID from replica A to replica B, and replica B can use it to find (their replica of) the original Collab. This lets you link to a place in a collection or even in a whole document, similar to a Position.

To convert between the Collabs in a collection (e.g., a CSet) and their CollabIDs, use the collection's IParent.idOf and IParent.fromID methods. More generally, you can use any ancestor of the Collabs or the top-level IRuntime/AbstractDoc.

CollabIDs are JSON objects and can be serialized with DefaultSerializer. You can also use CollabIDSerializer (in package @collabs/core).

Type Parameters

Type declaration

  • Readonly collabIDPath: string[]

    An internal description of where the Collab is located relative to the ancestor that created this CollabID.

    Typically, it is the path from the Collab to the ancestor in the tree of Collabs.

Cursor: Position | "START"

A cursor in a collaborative list or text string.

A Cursor points to a particular spot in a list, in between two list elements (or text characters). You can use Cursors as ordinary cursors or selection endpoints.

Use the Cursors class to convert between indices and Cursors.

Internally, a cursor is represented as a string. Specifically, it is the Position of the list element to its left, or "START" if it is at the beginning of the list. If that position is later deleted, the cursor stays the same, but its index shifts to the next element on its left.

Parent: IParent & (Collab | IRuntime)

Something that can be a parent of a Collab: either an IRuntime or a Collab that can have children.

Position: string

A position in a collaborative list (e.g. CList, CValueList, CText), represented as an opaque string.

A position points to a list entry immutably: unlike its index, an entry's position never changes.

The IList interface has methods to convert between a position, its value (if present), and its current index (or where it would be if present).

You can use positions as React keys, range endpoints for a comment on a document, etc.

See also: Cursor

Event emitted by CRuntime/AbstractDoc after applying an update.

Metadata for an update (message or saved state).


  • mergeMessages(messages: Uint8Array[]): Uint8Array
  • Experimental - message format is unstable.

    Merges the given messages, returning a single message that incorporates all of their transactions. This message may be passed to AbstractDoc.receive/CRuntime.receive as usual.


    If messages.length is 0.


    • messages: Uint8Array[]

      The messages to merge. These must come from either DocEventsRecord.Send events or previous mergeMessages calls.

    Returns Uint8Array

Generated using TypeDoc