@sovereignbase/convergent-replicated-text
    Preparing search index...

    Class CRText

    Represents a convergent replicated text document backed by CR-List state.

    Index

    Constructors

    Accessors

    • get size(): number

      Returns the current number of grapheme clusters in the text projection.

      Returns number

    Methods

    • Iterates over detached copies of the current live values in index order.

      Returns IterableIterator<string>

    • Returns the current text projection when coerced to a primitive.

      Returns string

    • Emits an acknowledgement frontier for the current replica state.

      Dispatches an ack event when an acknowledgement is produced.

      Returns void

    • Removes tombstoned history acknowledged by every provided frontier.

      Parameters

      • frontiers: string[]

        The acknowledgement frontiers that permit garbage collection.

      Returns void

    • Inserts characters immediately after the specified index.

      Pass -1 to insert at the beginning of the document.

      Parameters

      • index: number

        The anchor index after which the characters are inserted.

      • characters: string

        The text to insert.

      Returns void

      Thrown when the arguments are not a number and string pair.

    • Merges a remote delta into this replica.

      Dispatches a change event when the merge updates the current projection.

      Parameters

      Returns void

    • Removes characters starting at the specified index.

      Parameters

      • index: number

        The inclusive start index to remove from.

      • removeCount: number

        The number of characters to remove.

      Returns void

      Thrown when the arguments are not numeric.

    • Dispatches a detached snapshot of the current state.

      Returns void