SyncEvent: SyncEvent() constructor

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Note: This feature is only available in Service Workers.

The SyncEvent() constructor creates a new SyncEvent object.

Syntax

js
new SyncEvent(type, options)

Parameters

type

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

options

An object that, in addition to the properties defined in ExtendableEvent(), can have the following properties:

tag

A developer-defined unique identifier for this SyncEvent.

lastChance Optional

A boolean value indicating that the user agent will not make further synchronization attempts after the current attempt. It defaults to false.

Return value

A new SyncEvent object.

Specifications

Specification
Web Background Synchronization
# dom-syncevent-syncevent

Browser compatibility

BCD tables only load in the browser