N

sync

namespace sync

Functions

F

deleteData(): Promise<boolean>

Deletes the stored document and turns syncing off on this device, so it is not uploaded again. Other devices keep what they have installed.

Returns

Whether the document was deleted. Failures are recorded as lastError.

Returns

Which way automatic syncs move changes on this device.

F

isApplying(): boolean

Returns

Whether a sync is applying remote changes right now, so the changes it makes can be told apart.

F

isEnabled(): boolean

Returns

Whether this device syncs automatically.

F

now(strategy?: SyncStrategy): Promise<boolean>

Syncs now: reads the stored document, merges, applies remote changes here and saves the result. A call while a sync runs queues one more run after it, in this device's mode.

Returns

Whether the sync succeeded. Failures are recorded as lastError in SYNC_BUCKET.

F

resolveFirstSync(strategy: SyncStrategy): Promise<boolean>

Settles how this device and an existing cloud setup combine on the first sync after signing in, then turns automatic syncing on.

Returns

Whether the sync succeeded.

F

setEnabled(enabled: boolean): Promise<boolean>

Turns automatic syncing on or off. Turning it on syncs right away, or first asks how to combine this device with a cloud setup it has never synced with.

Returns

Whether turning it on could read the cloud; always true when turning it off.

F

setMode(mode: SyncMode): void

Sets which way automatic syncs move changes, syncing right away when sync is on.

Types

Which way automatic syncs move changes on this device.

How one sync reconciles the two sides: merge keeps changes from both, pull makes this device match the cloud, and push makes the cloud match this device.

Variables

V

SYNC_BUCKET: "unbound::sync"

The Bucket Sync keeps its mode and last agreed document in. Never synced.