PeriodicSyncEvent: PeriodicSyncEvent() constructor

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

Note: This feature is only available in Service Workers.

The PeriodicSyncEvent() constructor creates a new PeriodicSyncEvent object. This constructor is not typically used. The browser creates these objects itself and provides them to onperiodicsync callback.

Syntax

js
new PeriodicSyncEvent(type, options)

Parameters

type

A string with the name of the event. It is case-sensitive and browsers set it to periodicsync.

options

An object that, in addition of the properties defined in Event(), can have the following properties:

tag

The tag referencing the sync event.

Return value

A new PeriodicSyncEvent object configured using the given inputs.

Examples

This example constructs a new PeriodicSyncEvent with the relevant associated tag.

js
const psEvent = new ExtendableEvent("periodicsync", { tag: "unique-tag" });

Specifications

Specification
Web Periodic Background Synchronization
# dom-periodicsyncevent-periodicsyncevent

Browser compatibility

BCD tables only load in the browser

See also