SyncManager.register()

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The SyncManager.register method of the SyncManager interface returns a Promise that resolves to a SyncRegistration instance.

Syntax

register()
register(options)

Parameters

options Optional

An object that sets options for an instance of SyncRegistration. The available options are:

allowOnBattery

A boolean that determines whether synchronization is allowed when the user agent is on a battery-powered device. The default is true.

id

The unique identifier of the specified SyncRegistration object.

idleRequired

A boolean that determines whether synchronization is allowed when the user agent's device is idle. The default is false.

maxDelay

The maximum delay in milliseconds before the next sync event (or the first sync event if it is periodic). The default is 0, meaning there is no maximum delay.

minDelay

The minimum delay in milliseconds before the next sync event (or the first sync event if it is periodic). The default is 0.

minPeriod

The minimum time in milliseconds between periodic sync events. The default is 0, meaning events are not periodic.

minRequiredNetwork

The network condition under which background synchronization will occur. Valid values are 'network-any', 'network-offline', 'network-online', 'network-non-mobile'. The default value is 'network-online'.

Return value

A Promise that resolves to an instance of SyncRegistration.

Browser compatibility

BCD tables only load in the browser