BackgroundService

Defines events for background web platform features.

Constructors

Link copied to clipboard
constructor(cdp: CDP)

Types

Link copied to clipboard
@Serializable
data class BackgroundServiceEvent(val timestamp: Double, val origin: String, val serviceWorkerRegistrationId: String, val service: BackgroundService.ServiceName, val eventName: String, val instanceId: String, val eventMetadata: List<BackgroundService.EventMetadata>, val storageKey: String)
Link copied to clipboard
@Serializable
data class BackgroundServiceEventReceivedParameter(val backgroundServiceEvent: BackgroundService.BackgroundServiceEvent)

Called with all existing backgroundServiceEvents when enabled, and all new events afterwards if enabled and recording.

Link copied to clipboard
@Serializable
data class ClearEventsParameter(val service: BackgroundService.ServiceName)
Link copied to clipboard
@Serializable
data class EventMetadata(val key: String, val value: String)

A key-value pair for additional event information to pass along.

Link copied to clipboard
@Serializable
data class RecordingStateChangedParameter(val isRecording: Boolean, val service: BackgroundService.ServiceName)

Called when the recording state for the service has been updated.

Link copied to clipboard

The Background Service that will be associated with the commands/events. Every Background Service operates independently, but they share the same API.

Link copied to clipboard
@Serializable
data class SetRecordingParameter(val shouldRecord: Boolean, val service: BackgroundService.ServiceName)
Link copied to clipboard
@Serializable
data class StartObservingParameter(val service: BackgroundService.ServiceName)
Link copied to clipboard
@Serializable
data class StopObservingParameter(val service: BackgroundService.ServiceName)

Properties

Link copied to clipboard

Called with all existing backgroundServiceEvents when enabled, and all new events afterwards if enabled and recording.

Link copied to clipboard

Called when the recording state for the service has been updated.

Functions

Link copied to clipboard
suspend fun clearEvents(args: BackgroundService.ClearEventsParameter, mode: CommandMode = CommandMode.DEFAULT)

Clears all stored data for the service.

Link copied to clipboard
suspend fun setRecording(args: BackgroundService.SetRecordingParameter, mode: CommandMode = CommandMode.DEFAULT)
suspend fun setRecording(shouldRecord: Boolean, service: BackgroundService.ServiceName)

Set the recording state for the service.

Link copied to clipboard
suspend fun startObserving(args: BackgroundService.StartObservingParameter, mode: CommandMode = CommandMode.DEFAULT)

Enables event updates for the service.

Link copied to clipboard
suspend fun stopObserving(args: BackgroundService.StopObservingParameter, mode: CommandMode = CommandMode.DEFAULT)

Disables event updates for the service.