vivaldi.sync Modders API Reference
Use vivaldi.sync
for sync messages.
Types
#SyncNotificationClientStatus
ENUM
Used to report whether we have a connection to the notification server.
- connected
- disconnected
#EngineState
ENUM
The state of the sync engine.
- stopped: Sync has not been requested by the user
- starting: Sync has been requested but the engine is not done starting
- starting_server_error: Sync has been requested but the engine is not done starting and can't do so because of a server issue
- started: The sync engine is running normally
- clearing_data: The sync engine is running, but it is in the process of requesting server data to be cleared.
- configuration_pending: The sync engine is running, but it is waiting for the current setup to be complete before actually syncing anything
- failed: The sync engine encountered an error that forced it to stop.
#DisableReason
ENUM
The reason why the sync engine is in a failed state. This should be kept in sync with SyncService::DisableReason (chromium/components/sync/driver/sync_service.h)
- enterprise_policy
- not_signed_in
- unrecoverable_error
- flag
#CycleStatus
ENUM
Error occuring as part of the sync cycle. This should be kept in sync with VivaldiSyncUIHelper::CycleStatus (sync/vivaldi_sync_ui_helper.h)
- not_synced
- success
- auth_error
- server_error
- network_error
- conflict
- throttled
- other_error
#ProtocolErrorType
ENUM
Possible error types for errors returned as part of sync server responses. This should be kept in sync with syncer::SyncProtocolErrorType (chromium/components/sync/protocol/sync_protocol_error.h)
- success
- not_my_birthday
- throttled
- transient_error
- migration_done
- disabled_by_admin
- partial_failure
- client_data_obsolete
- encryption_obsolete
- conflict
- invalid_message
- unknown
#ClientAction
ENUM
Possible action that the client can take to fix the last server-returned error. This should be kept in sync with syncer::ClientAction (chromium/components/sync/protocol/sync_protocol_error.h)
- upgrade_client
- disable_sync_on_client
- stop_sync_for_disabled_account
- reset_local_sync_data
- unknown
#DataType
ENUM
User selectable data types that we support
- bookmarks
- preferences
- passwords
- autofill
- history
- extensions
- apps
- reading_list
- tabs
- notes
#DataTypeSelection
A structure containing the system status of a data type.
Properties:
- dataType
DataType
⚠ NO DESCRIPTION PROVIDED
- enabled
boolean
true if we want to sync this data type, otherwise false.
#EngineData
Contains information about the state of the sync engine.
Properties:
- engineState
EngineState
⚠ NO DESCRIPTION PROVIDED
- disableReasons
⚠ NO DESCRIPTION PROVIDED
Array
of:- DisableReason
- protocolErrorType
ProtocolErrorType
⚠ NO DESCRIPTION PROVIDED
- protocolErrorDescription
string
Plain english description of the error as sent by the server
- protocolErrorClientAction
ClientAction
⚠ NO DESCRIPTION PROVIDED
- usesEncryptionPassword
boolean
Whether encryption has been set up
- needsDecryptionPassword
boolean
Whether a password is needed to decrypt the sync data
- isEncryptingEverything
boolean
Wheter the engine is encrypting all data types
- isSetupInProgress
boolean
Whether the sync service is being configured.
- isFirstSetupComplete
boolean
Whether the sync service has been configured and started before.
- syncEverything
boolean
Indicates that all datatypes will always be synced.
- dataTypes
List of available data types and whether the user chose to sync them.
Array
of:- DataTypeSelection
- isReady
boolean
⚠ NO DESCRIPTION PROVIDED
#CycleData
Contains information about the last sync cycle.
Properties:
- cycleStartTime
number
The last time a sync cycle started.
- downloadUpdatesStatus
CycleStatus
Whether the download updates part of the last sync cycle was successful
- commitStatus
CycleStatus
Whether the commit part of the last sync cycle was successful
- nextRetryTime
number
The time at which the next sync attempt will be made, if the last one failed
- isReady
boolean
⚠ NO DESCRIPTION PROVIDED
Listeners
How to use listeners
Each listener type has the same functions, used for each listener API in the same way:
.addListener(function
callback)
Adds a function to a listener for an event
.removeListener(function
callback)
Removes a function to a listener for an event
.hasListener(function
callback)
Returns a boolean if a function is attached to a listener for an event
.hasListeners()
Returns a boolean if a listener has any attached functions
.dispatch()
Returns array of promises dispatched to the listener
#onEngineStateChanged
Fired when the sync engine state has changed.
Parameters:
- data
EngineData
⚠ NO DESCRIPTION PROVIDED
#onCycleCompleted
Fired when a sync cycle completed.
Parameters:
- data
CycleData
⚠ NO DESCRIPTION PROVIDED
Methods
#start
Starts up sync. Feedback about the startup process can be obtained by listening to onEngineStateChanged.
#setEncryptionPassword
Sets the password to use for encryption/decryption of Sync data. If an empty password is supplied, the password supplied when logging in will be used.
Parameters:
- password
- (optional)
string
The encryption password to use. If not specified, We will attempt to use the currently stored login password instead.
#backupEncryptionToken
Saves the token derived from the encryption password to a file
Parameters:
- target_file
string
The file to which the token should be saved
#restoreEncryptionToken
Uses a previously backed-up token to set up encryption
Parameters:
- source_file
string
The file from which the token should be recovered
#getDefaultSessionName
Returns the device name as determined by the OS.
#setTypes
Sets which data types should be synced
Parameters:
- syncEverything
boolean
Sets which datatypes sould be synced.
- types
List of data types to be enabled
Array
of:- DataTypeSelection
#getEngineState
Returns informations about the status of the sync engine.
#getLastCycleState
Returns informations about the status of the last sync cycle.
#setupComplete
Informs the backend that the user is done configuring sync types
#clearData
Clear all the user's data on the server side and logs them out