backgroundservice

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MIT, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package backgroundservice provides the Chrome DevTools Protocol commands, types, and events for the BackgroundService domain.

Defines events for background web platform features.

Generated by the cdproto-gen command.

Index

Constants

View Source
const (
	CommandStartObserving = "BackgroundService.startObserving"
	CommandStopObserving  = "BackgroundService.stopObserving"
	CommandSetRecording   = "BackgroundService.setRecording"
	CommandClearEvents    = "BackgroundService.clearEvents"
)

Command names.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClearEventsParams

type ClearEventsParams struct {
	Service ServiceName `json:"service"`
}

ClearEventsParams clears all stored data for the service.

func ClearEvents

func ClearEvents(service ServiceName) *ClearEventsParams

ClearEvents clears all stored data for the service.

See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#method-clearEvents

parameters:

service

func (*ClearEventsParams) Do

func (p *ClearEventsParams) Do(ctx context.Context) (err error)

Do executes BackgroundService.clearEvents against the provided context.

type Event

type Event struct {
	Timestamp                   *cdp.TimeSinceEpoch          `json:"timestamp"`                   // Timestamp of the event (in seconds).
	Origin                      string                       `json:"origin"`                      // The origin this event belongs to.
	ServiceWorkerRegistrationID serviceworker.RegistrationID `json:"serviceWorkerRegistrationId"` // The Service Worker ID that initiated the event.
	Service                     ServiceName                  `json:"service"`                     // The Background Service this event belongs to.
	EventName                   string                       `json:"eventName"`                   // A description of the event.
	InstanceID                  string                       `json:"instanceId"`                  // An identifier that groups related events together.
	EventMetadata               []*EventMetadata             `json:"eventMetadata"`               // A list of event-specific information.
	StorageKey                  string                       `json:"storageKey"`                  // Storage key this event belongs to.
}

Event [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#type-BackgroundServiceEvent

type EventBackgroundServiceEventReceived

type EventBackgroundServiceEventReceived struct {
	BackgroundServiceEvent *Event `json:"backgroundServiceEvent"`
}

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

See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#event-backgroundServiceEventReceived

type EventMetadata

type EventMetadata struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

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

See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#type-EventMetadata

type EventRecordingStateChanged

type EventRecordingStateChanged struct {
	IsRecording bool        `json:"isRecording"`
	Service     ServiceName `json:"service"`
}

EventRecordingStateChanged called when the recording state for the service has been updated.

See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#event-recordingStateChanged

type ServiceName

type ServiceName string

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

See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#type-ServiceName

const (
	ServiceNameBackgroundFetch        ServiceName = "backgroundFetch"
	ServiceNameBackgroundSync         ServiceName = "backgroundSync"
	ServiceNamePushMessaging          ServiceName = "pushMessaging"
	ServiceNameNotifications          ServiceName = "notifications"
	ServiceNamePaymentHandler         ServiceName = "paymentHandler"
	ServiceNamePeriodicBackgroundSync ServiceName = "periodicBackgroundSync"
)

ServiceName values.

func (ServiceName) MarshalJSON

func (t ServiceName) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler.

func (ServiceName) String

func (t ServiceName) String() string

String returns the ServiceName as string value.

func (*ServiceName) UnmarshalJSON

func (t *ServiceName) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies json.Unmarshaler.

type SetRecordingParams

type SetRecordingParams struct {
	ShouldRecord bool        `json:"shouldRecord"`
	Service      ServiceName `json:"service"`
}

SetRecordingParams set the recording state for the service.

func SetRecording

func SetRecording(shouldRecord bool, service ServiceName) *SetRecordingParams

SetRecording set the recording state for the service.

See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#method-setRecording

parameters:

shouldRecord
service

func (*SetRecordingParams) Do

func (p *SetRecordingParams) Do(ctx context.Context) (err error)

Do executes BackgroundService.setRecording against the provided context.

type StartObservingParams

type StartObservingParams struct {
	Service ServiceName `json:"service"`
}

StartObservingParams enables event updates for the service.

func StartObserving

func StartObserving(service ServiceName) *StartObservingParams

StartObserving enables event updates for the service.

See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#method-startObserving

parameters:

service

func (*StartObservingParams) Do

func (p *StartObservingParams) Do(ctx context.Context) (err error)

Do executes BackgroundService.startObserving against the provided context.

type StopObservingParams

type StopObservingParams struct {
	Service ServiceName `json:"service"`
}

StopObservingParams disables event updates for the service.

func StopObserving

func StopObserving(service ServiceName) *StopObservingParams

StopObserving disables event updates for the service.

See: https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService#method-stopObserving

parameters:

service

func (*StopObservingParams) Do

func (p *StopObservingParams) Do(ctx context.Context) (err error)

Do executes BackgroundService.stopObserving against the provided context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL