Help us shape the future of Go! Take the 2026 Go Developer Survey

serviceworker

package
v0.159.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 2 Imported by: 7

Documentation

Overview

Package serviceworker provides the Chrome DevTools Protocol commands, types, and events for the ServiceWorker domain.

Generated by the pdlgen command.

Index

Constants

View Source
const (
	CommandDeliverPushMessage        = "ServiceWorker.deliverPushMessage"
	CommandDisable                   = "ServiceWorker.disable"
	CommandDispatchSyncEvent         = "ServiceWorker.dispatchSyncEvent"
	CommandDispatchPeriodicSyncEvent = "ServiceWorker.dispatchPeriodicSyncEvent"
	CommandEnable                    = "ServiceWorker.enable"
	CommandSetForceUpdateOnPageLoad  = "ServiceWorker.setForceUpdateOnPageLoad"
	CommandSkipWaiting               = "ServiceWorker.skipWaiting"
	CommandStartWorker               = "ServiceWorker.startWorker"
	CommandStopAllWorkers            = "ServiceWorker.stopAllWorkers"
	CommandStopWorker                = "ServiceWorker.stopWorker"
	CommandUnregister                = "ServiceWorker.unregister"
	CommandUpdateRegistration        = "ServiceWorker.updateRegistration"
)

Command names.

Variables

DeliverPushMessage [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-deliverPushMessage

View Source
var Disable = cdp.Command[cdp.Empty, cdp.Empty]{Method: CommandDisable}

Disable [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-disable

DispatchPeriodicSyncEvent [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-dispatchPeriodicSyncEvent

DispatchSyncEvent [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-dispatchSyncEvent

Enable [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-enable

SetForceUpdateOnPageLoad [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-setForceUpdateOnPageLoad

SkipWaiting [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-skipWaiting

StartWorker [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-startWorker

View Source
var StopAllWorkers = cdp.Command[cdp.Empty, cdp.Empty]{Method: CommandStopAllWorkers}

StopAllWorkers [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-stopAllWorkers

StopWorker [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-stopWorker

Unregister [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-unregister

UpdateRegistration [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#method-updateRegistration

View Source
var WorkerErrorReported = cdp.Event[EventWorkerErrorReported]{Method: "ServiceWorker.workerErrorReported"}

WorkerErrorReported [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#event-workerErrorReported

View Source
var WorkerRegistrationUpdated = cdp.Event[EventWorkerRegistrationUpdated]{Method: "ServiceWorker.workerRegistrationUpdated"}

WorkerRegistrationUpdated [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#event-workerRegistrationUpdated

View Source
var WorkerVersionUpdated = cdp.Event[EventWorkerVersionUpdated]{Method: "ServiceWorker.workerVersionUpdated"}

WorkerVersionUpdated [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#event-workerVersionUpdated

Functions

This section is empty.

Types

type DeliverPushMessageParams

type DeliverPushMessageParams struct {
	Origin         string         `json:"origin"`
	RegistrationID RegistrationID `json:"registrationId"`
	Data           string         `json:"data"`
}

DeliverPushMessageParams are the parameters of the command ServiceWorker.deliverPushMessage.

type DispatchPeriodicSyncEventParams

type DispatchPeriodicSyncEventParams struct {
	Origin         string         `json:"origin"`
	RegistrationID RegistrationID `json:"registrationId"`
	Tag            string         `json:"tag"`
}

DispatchPeriodicSyncEventParams are the parameters of the command ServiceWorker.dispatchPeriodicSyncEvent.

type DispatchSyncEventParams

type DispatchSyncEventParams struct {
	Origin         string         `json:"origin"`
	RegistrationID RegistrationID `json:"registrationId"`
	Tag            string         `json:"tag"`
	LastChance     bool           `json:"lastChance"`
}

DispatchSyncEventParams are the parameters of the command ServiceWorker.dispatchSyncEvent.

type ErrorMessage

type ErrorMessage struct {
	ErrorMessage   string         `json:"errorMessage"`
	RegistrationID RegistrationID `json:"registrationId"`
	VersionID      string         `json:"versionId"`
	SourceURL      string         `json:"sourceURL"`
	LineNumber     int64          `json:"lineNumber"`
	ColumnNumber   int64          `json:"columnNumber"`
}

ErrorMessage serviceWorker error message.

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#type-ServiceWorkerErrorMessage

type EventWorkerErrorReported

type EventWorkerErrorReported struct {
	ErrorMessage *ErrorMessage `json:"errorMessage"`
}

EventWorkerErrorReported [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#event-workerErrorReported

type EventWorkerRegistrationUpdated

type EventWorkerRegistrationUpdated struct {
	Registrations []*Registration `json:"registrations"`
}

EventWorkerRegistrationUpdated [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#event-workerRegistrationUpdated

type EventWorkerVersionUpdated

type EventWorkerVersionUpdated struct {
	Versions []*Version `json:"versions"`
}

EventWorkerVersionUpdated [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#event-workerVersionUpdated

type Registration

type Registration struct {
	RegistrationID RegistrationID `json:"registrationId"`
	ScopeURL       string         `json:"scopeURL"`
	IsDeleted      bool           `json:"isDeleted"`
}

Registration serviceWorker registration.

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#type-ServiceWorkerRegistration

type RegistrationID

type RegistrationID string

RegistrationID [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#type-RegistrationID

func (RegistrationID) String

func (t RegistrationID) String() string

String returns the RegistrationID as string value.

type RouterCondition

type RouterCondition struct {
	URLPattern         string               `json:"urlPattern,omitempty,omitzero"` // Plain text, or JSON serialization of URLPatternInit or URLPattern
	RequestMethod      string               `json:"requestMethod,omitempty,omitzero"`
	RequestMode        string               `json:"requestMode,omitempty,omitzero"`
	RequestDestination string               `json:"requestDestination,omitempty,omitzero"`
	RunningStatus      VersionRunningStatus `json:"runningStatus,omitempty,omitzero"`
	Or                 []*RouterCondition   `json:"or,omitempty,omitzero"`
	Not                *RouterCondition     `json:"not,omitempty,omitzero"`
}

RouterCondition mostly corresponds to RouterCondition in ServiceWorker spec (https://www.w3.org/TR/service-workers/#dictdef-routercondition).

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#type-ServiceWorkerRouterCondition

type RouterRule

type RouterRule struct {
	Condition *RouterCondition `json:"condition"`
	Source    *RouterSource    `json:"source"`
	ID        int64            `json:"id"` // Rule ID assigned by the browser. Unique within each ServiceWorkerVersion.
}

RouterRule [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#type-ServiceWorkerRouterRule

type RouterSource

type RouterSource struct {
	Type       RouterSourceType  `json:"type"`
	SourceDict *RouterSourceDict `json:"sourceDict,omitempty,omitzero"` // Non-empty iff type equals "sourceDict".
}

RouterSource corresponds to RouterSource in the spec while the representation is different as follows. (https://www.w3.org/TR/service-workers/#typedefdef-routersource) - RouterSourceEnum: type equals cache, sourceDict is null. - RouterSourceDict: type equals sourceDict, sourceDict has valid value.

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#type-ServiceWorkerRouterSource

type RouterSourceType

type RouterSourceType string

RouterSourceType [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#type-ServiceWorkerRouterSourceType

const (
	RouterSourceTypeCache                      RouterSourceType = "cache"
	RouterSourceTypeFetchEvent                 RouterSourceType = "fetchEvent"
	RouterSourceTypeNetwork                    RouterSourceType = "network"
	RouterSourceTypeRaceNetworkAndFetchHandler RouterSourceType = "raceNetworkAndFetchHandler"
	RouterSourceTypeRaceNetworkAndCache        RouterSourceType = "raceNetworkAndCache"
	RouterSourceTypeSourceDict                 RouterSourceType = "sourceDict"
)

RouterSourceType values.

func (RouterSourceType) String

func (t RouterSourceType) String() string

String returns the RouterSourceType as string value.

type SetForceUpdateOnPageLoadParams

type SetForceUpdateOnPageLoadParams struct {
	ForceUpdateOnPageLoad bool `json:"forceUpdateOnPageLoad"`
}

SetForceUpdateOnPageLoadParams are the parameters of the command ServiceWorker.setForceUpdateOnPageLoad.

type SkipWaitingParams

type SkipWaitingParams struct {
	ScopeURL string `json:"scopeURL"`
}

SkipWaitingParams are the parameters of the command ServiceWorker.skipWaiting.

type StartWorkerParams

type StartWorkerParams struct {
	ScopeURL string `json:"scopeURL"`
}

StartWorkerParams are the parameters of the command ServiceWorker.startWorker.

type StopWorkerParams

type StopWorkerParams struct {
	VersionID string `json:"versionId"`
}

StopWorkerParams are the parameters of the command ServiceWorker.stopWorker.

type UnregisterParams

type UnregisterParams struct {
	ScopeURL string `json:"scopeURL"`
}

UnregisterParams are the parameters of the command ServiceWorker.unregister.

type UpdateRegistrationParams

type UpdateRegistrationParams struct {
	ScopeURL string `json:"scopeURL"`
}

UpdateRegistrationParams are the parameters of the command ServiceWorker.updateRegistration.

type Version

type Version struct {
	VersionID          string               `json:"versionId"`
	RegistrationID     RegistrationID       `json:"registrationId"`
	ScriptURL          string               `json:"scriptURL"`
	RunningStatus      VersionRunningStatus `json:"runningStatus"`
	Status             VersionStatus        `json:"status"`
	ScriptLastModified float64              `json:"scriptLastModified,omitempty,omitzero"` // The Last-Modified header value of the main script.
	ScriptResponseTime float64              `json:"scriptResponseTime,omitempty,omitzero"` // The time at which the response headers of the main script were received from the server. For cached script it is the last time the cache entry was validated.
	ControlledClients  []target.ID          `json:"controlledClients,omitempty,omitzero"`
	TargetID           target.ID            `json:"targetId,omitempty,omitzero"`
	RouterRules        string               `json:"routerRules,omitempty,omitzero"` // Migration to typedRouterRules is in progress. The browser sends either routerRules or typedRouterRules. TODO(crbug.com/540469610): Remove routerRules after the migration.
	TypedRouterRules   []*RouterRule        `json:"typedRouterRules,omitempty,omitzero"`
}

Version serviceWorker version.

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#type-ServiceWorkerVersion

type VersionRunningStatus

type VersionRunningStatus string

VersionRunningStatus [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#type-ServiceWorkerVersionRunningStatus

const (
	VersionRunningStatusStopped  VersionRunningStatus = "stopped"
	VersionRunningStatusStarting VersionRunningStatus = "starting"
	VersionRunningStatusRunning  VersionRunningStatus = "running"
	VersionRunningStatusStopping VersionRunningStatus = "stopping"
)

VersionRunningStatus values.

func (VersionRunningStatus) String

func (t VersionRunningStatus) String() string

String returns the VersionRunningStatus as string value.

type VersionStatus

type VersionStatus string

VersionStatus [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker#type-ServiceWorkerVersionStatus

const (
	VersionStatusNew        VersionStatus = "new"
	VersionStatusInstalling VersionStatus = "installing"
	VersionStatusInstalled  VersionStatus = "installed"
	VersionStatusActivating VersionStatus = "activating"
	VersionStatusActivated  VersionStatus = "activated"
	VersionStatusRedundant  VersionStatus = "redundant"
)

VersionStatus values.

func (VersionStatus) String

func (t VersionStatus) String() string

String returns the VersionStatus as string value.

Jump to

Keyboard shortcuts

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