The Sync API provides functions for interacting with the sync engine when the client runs in Sync mode.
Checks if a sync is currently in progress.
Example:
if sync.isSyncing() then
print("Sync in progress...")
end
Checks if an initial sync has completed.
Example:
if sync.hasInitialSyncCompleted() then
print("Initial sync completed")
else
print("Waiting for initial sync...")
end
Immediately synchronizes a file with the server. Returns once the synchronization has completed.
Example:
sync.performFileSync("notes/important.md")
Immediately triggers a full space sync. Returns -1 if a sync was already ongoing, or the number of sync operations performed.
Example:
local changes = sync.scheduleSpaceSync()
print("Number of changes synced: " .. changes)