BackgroundService Domain
Defines events for background web platform features.
Methods
- BackgroundService.clearEvents
- BackgroundService.setRecording
- BackgroundService.startObserving
- BackgroundService.stopObserving
Events
Types
Methods
BackgroundService.setRecording #
Set the recording state for the service.
Parameters
shouldRecord
boolean
service
Events
BackgroundService.backgroundServiceEventReceived #
Called with all existing backgroundServiceEvents when enabled, and all new events afterwards if enabled and recording.
Parameters
backgroundServiceEvent
BackgroundService.recordingStateChanged #
Called when the recording state for the service has been updated.
Parameters
isRecording
boolean
service
Types
BackgroundService.BackgroundServiceEvent #
Type: object
Properties
timestamp
Timestamp of the event (in seconds).
origin
string
The origin this event belongs to.
serviceWorkerRegistrationId
The Service Worker ID that initiated the event.
service
The Background Service this event belongs to.
eventName
string
A description of the event.
instanceId
string
An identifier that groups related events together.
eventMetadata
array[ EventMetadata ]
A list of event-specific information.
storageKey
string
Storage key this event belongs to.
BackgroundService.EventMetadata #
A key-value pair for additional event information to pass along.
Type: object
Properties
key
string
value
string
BackgroundService.ServiceName #
The Background Service that will be associated with the commands/events. Every Background Service operates independently, but they share the same API.
Type: string
Allowed values: backgroundFetch
, backgroundSync
, pushMessaging
, notifications
, paymentHandler
, periodicBackgroundSync