JSPM

  • Created
  • Published
  • Downloads 53521
  • Score
    100M100P100Q140720F
  • License GPL-2.0-or-later

Sync Data.

Package Exports

  • @wordpress/sync
  • @wordpress/sync/build-module/index.js
  • @wordpress/sync/build/index.js
  • @wordpress/sync/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@wordpress/sync) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Sync

Sync data between multiple peers and persist in a local database.

Installation

Install the module

npm install @wordpress/sync --save

API

connectIndexDb

Connect function to the IndexedDB persistence provider.

Parameters

  • objectId ObjectID: The object ID.
  • objectType ObjectType: The object type.
  • doc CRDTDoc: The CRDT document.

Returns

  • Promise<() => void>: Promise that resolves when the connection is established.

createSyncProvider

Create a sync provider.

Parameters

  • connectLocal ConnectDoc: Connect the document to a local database.
  • connectRemote ConnectDoc: Connect the document to a remote sync connection.

Returns

  • SyncProvider: Sync provider.

createWebRTCConnection

Function that creates a new WebRTC Connection.

Parameters

  • config Object: The object ID.
  • config.signaling Array<string>:
  • config.password string:

Returns

  • Function: Promise that resolves when the connection is established.

Contributing to this package

This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to npm and used by WordPress as well as other software projects.

To find out more about contributing to this package or Gutenberg as a whole, please read the project's main contributor guide.



Code is Poetry.