Skip to main content

SyncStatus

Constructors

new SyncStatus()

new SyncStatus(options): SyncStatus

Parameters

ParameterType
optionsSyncStatusOptions

Returns

SyncStatus

Accessors

connected

Get Signature

get connected(): boolean

true if currently connected.

Returns

boolean


connecting

Get Signature

get connecting(): boolean
Returns

boolean


dataFlowStatus

Get Signature

get dataFlowStatus(): Partial<{
downloading: boolean;
uploading: boolean;
}>

Upload/download status

Returns

Partial<{ downloading: boolean; uploading: boolean; }>


hasSynced

Get Signature

get hasSynced(): undefined | boolean

Indicates whether there has been at least one full sync, if any. Is undefined when unknown, for example when state is still being loaded from the database.

Returns

undefined | boolean


lastSyncedAt

Get Signature

get lastSyncedAt(): undefined | Date

Time that a last sync has fully completed, if any. Currently this is reset to null after a restart.

Returns

undefined | Date


priorityStatusEntries

Get Signature

get priorityStatusEntries(): SyncPriorityStatus[]

Partial sync status for involved bucket priorities.

Returns

SyncPriorityStatus[]

Methods

getMessage()

getMessage(): string

Returns

string


isEqual()

isEqual(status): boolean

Parameters

ParameterType
statusSyncStatus

Returns

boolean


statusForPriority()

statusForPriority(priority): SyncPriorityStatus

Reports a pair of SyncStatus#hasSynced and SyncStatus#lastSyncedAt fields that apply to a specific bucket priority instead of the entire sync operation.

When buckets with different priorities are declared, PowerSync may choose to synchronize higher-priority buckets first. When a consistent view over all buckets for all priorities up until the given priority is reached, PowerSync makes data from those buckets available before lower-priority buckets have finished synchronizing. When PowerSync makes data for a given priority available, all buckets in higher-priorities are guaranteed to be consistent with that checkpoint. For this reason, this method may also return the status for lower priorities. In a state where the PowerSync just finished synchronizing buckets in priority level 3, calling this method with a priority of 1 may return information for priority level 3.

Parameters

ParameterTypeDescription
prioritynumberThe bucket priority for which the status should be reported.

Returns

SyncPriorityStatus


toJSON()

toJSON(): SyncStatusOptions

Returns

SyncStatusOptions