BackgroundService Domain
Defines events for background web platform features.
Methods
Events
Types
Methods
BackgroundService.clearEvents #
Clears all stored data for the service.
parameters
- service
-
ServiceName
BackgroundService.setRecording #
Set the recording state for the service.
parameters
- shouldRecord
-
boolean
- service
-
ServiceName
BackgroundService.startObserving #
Enables event updates for the service.
parameters
- service
-
ServiceName
BackgroundService.stopObserving #
Disables event updates for the service.
parameters
- service
-
ServiceName
Events
BackgroundService.backgroundServiceEventReceived #
Called with all existing backgroundServiceEvents when enabled, and all new events afterwards if enabled and recording.
parameters
- backgroundServiceEvent
-
BackgroundServiceEvent
BackgroundService.recordingStateChanged #
Called when the recording state for the service has been updated.
parameters
- isRecording
-
boolean
- service
-
ServiceName
Types
BackgroundService.BackgroundServiceEvent #
Type: object
properties
- timestamp
-
Network.TimeSinceEpoch
Timestamp of the event (in seconds).
- origin
-
string
The origin this event belongs to.
- serviceWorkerRegistrationId
-
ServiceWorker.RegistrationID
The Service Worker ID that initiated the event.
- service
-
ServiceName
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.
backgroundFetch
, backgroundSync
, pushMessaging
, notifications
, paymentHandler
, periodicBackgroundSync
Type: string