@couchbase/lite-js
    Preparing search index...

    Class Replicator

    Syncs one or more Collections with their remote counterparts.

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    database: Database

    The local database being replicated.

    logger: Logger
    onDocuments?: (
        collection: Collection,
        direction: "push" | "pull",
        documents: DocumentEnded[],
    ) => void

    Callback that notifies when documents have been pushed or pulled.

    Note: To receive lost-access (revocation) notifications from the pull replicator when auto-purge is disabled, this callback must be registered before starting the pull replicator.

    onStatusChange?: (status: ReplicatorStatus) => void

    Callback that notifies when status changes.

    Accessors

    Methods

    • Runs the replicator.

      This is an async operation. The returned Promise resolves when the replication completes. A continuous replication usually never completes, unless it encounters a fatal error or you stop it, so you may not want to await it.

      Returns Promise<void>

    • Stops the replicator. The current run operation's Promise will resolve with an error as soon as possible.

      Does nothing if run is not active.

      Returns void