• Public
  • Public/Protected
  • All

Interface IRuntime

A runtime for a Collabs document, responsible for connecting replicas of Collabs across devices and for other whole-document functionality.

IRuntime is a general interface; specific replication techniques are expected to provide their own implementations, such as CRuntime for CRDTs.

A runtime creates and manages the tree of Collabs for a document, and it provides utilities for those Collabs (e.g., replicaID). Each Collab can access its runtime using Collab.runtime.

A runtime also delivers updates between replicas with runtime-specific guarantees. For example, CRuntime guarantees that messages are broadcast exactly-once in causal order with immediate delivery of local messages.


Implemented by



isRuntime: true
replicaID: string

An ID that uniquely identifies this replica among all connected replicas.

You often access this through Collab.runtime, e.g., this.runtime.replicaID in a Collab subclass.


  • fromID<C>(id: CollabID<C>): undefined | C
  • Inverse of idOf.

    Specifically, given a CollabID returned by idOf on some replica of this runtime, returns this replica's copy of the original collab. If that Collab does not exist (e.g., it was deleted or it is not present in this program version), returns undefined.

    Type Parameters


    Returns undefined | C

  • Returns a CollabID for the given Collab.

    The CollabID may be passed to fromID on any replica of this runtime to obtain that replica's copy of collab.

    Type Parameters


    • collab: C

      A Collab that belongs to this runtime.

    Returns CollabID<C>

Generated using TypeDoc