BackgroundService#
Defines events for background web platform features.
This CDP domain is experimental.
Types#
Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.
- class ServiceName(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
The Background Service that will be associated with the commands/events. Every Background Service operates independently, but they share the same API.
- BACKGROUND_FETCH = 'backgroundFetch'#
- BACKGROUND_SYNC = 'backgroundSync'#
- PUSH_MESSAGING = 'pushMessaging'#
- NOTIFICATIONS = 'notifications'#
- PAYMENT_HANDLER = 'paymentHandler'#
- PERIODIC_BACKGROUND_SYNC = 'periodicBackgroundSync'#
- class EventMetadata(key, value)[source]#
A key-value pair for additional event information to pass along.
- class BackgroundServiceEvent(timestamp, origin, service_worker_registration_id, service, event_name, instance_id, event_metadata, storage_key)[source]#
-
timestamp:
TimeSinceEpoch# Timestamp of the event (in seconds).
-
service_worker_registration_id:
RegistrationID# The Service Worker ID that initiated the event.
-
service:
ServiceName# The Background Service this event belongs to.
-
event_metadata:
List[EventMetadata]# A list of event-specific information.
-
timestamp:
Commands#
Each command is a generator function. The return
type Generator[x, y, z] indicates that the generator
yields arguments of type x, it must be resumed with
an argument of type y, and it returns type z. In
this library, types x and y are the same for all
commands, and z is the return type you should pay attention
to. For more information, see
Getting Started: Commands.
Events#
Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.
- class RecordingStateChanged(is_recording, service)[source]#
Called when the recording state for the service has been updated.
-
service:
ServiceName#
-
service:
- class BackgroundServiceEventReceived(background_service_event)[source]#
Called with all existing backgroundServiceEvents when enabled, and all new events afterwards if enabled and recording.
-
background_service_event:
BackgroundServiceEvent#
-
background_service_event: