@yorkie-js/sdk
    Preparing search index...

    Interface DocStore

    DocStore is a pluggable persistence backend for offline document state. The client serializes a document with Document.toBytes() and hands the resulting envelope to save; on a later attach it calls load and, when bytes are present, rehydrates the document via Document.fromBytes so un-pushed local changes survive a reload.

    The interface is intentionally byte-oriented and async so that a durable backend (e.g. IndexedDB) can implement it without the client knowing which storage it talks to. The default MemoryDocStore keeps everything in a process-local map and is dependency-free.

    interface DocStore {
        load(docKey: string): Promise<Uint8Array<ArrayBufferLike> | undefined>;
        remove(docKey: string): Promise<void>;
        save(docKey: string, bytes: Uint8Array): Promise<void>;
    }

    Implemented by

    Index

    Methods

    Methods

    • load returns the persisted bytes for the given document key, or undefined when nothing has been stored for it.

      Parameters

      • docKey: string

      Returns Promise<Uint8Array<ArrayBufferLike> | undefined>

    • remove deletes any persisted bytes for the document key. It is a no-op when nothing is stored.

      Parameters

      • docKey: string

      Returns Promise<void>

    • save persists the given bytes for the document key, overwriting any previously stored value.

      Parameters

      • docKey: string
      • bytes: Uint8Array

      Returns Promise<void>