Documentation ¶
Overview ¶
Package backgroundservice implements the BackgroundService domain. Defines events for background web platform features.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClearEventsArgs ¶
type ClearEventsArgs struct {
Service ServiceName `json:"service"` // No description.
}
ClearEventsArgs represents the arguments for ClearEvents in the BackgroundService domain.
func NewClearEventsArgs ¶
func NewClearEventsArgs(service ServiceName) *ClearEventsArgs
NewClearEventsArgs initializes ClearEventsArgs with the required arguments.
type Event ¶
type Event struct { Timestamp network.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. }
Event
type EventMetadata ¶
type EventMetadata struct { Key string `json:"key"` // No description. Value string `json:"value"` // No description. }
EventMetadata A key-value pair for additional event information to pass along.
type EventReceivedClient ¶
type EventReceivedClient interface { // Recv calls RecvMsg on rpcc.Stream, blocks until the event is // triggered, context canceled or connection closed. Recv() (*EventReceivedReply, error) rpcc.Stream }
EventReceivedClient is a client for BackgroundServiceEventReceived events. Called with all existing backgroundServiceEvents when enabled, and all new events afterwards if enabled and recording.
type EventReceivedReply ¶
type EventReceivedReply struct {
BackgroundServiceEvent Event `json:"backgroundServiceEvent"` // No description.
}
EventReceivedReply is the reply for BackgroundServiceEventReceived events.
type RecordingStateChangedClient ¶
type RecordingStateChangedClient interface { // Recv calls RecvMsg on rpcc.Stream, blocks until the event is // triggered, context canceled or connection closed. Recv() (*RecordingStateChangedReply, error) rpcc.Stream }
RecordingStateChangedClient is a client for RecordingStateChanged events. Called when the recording state for the service has been updated.
type RecordingStateChangedReply ¶
type RecordingStateChangedReply struct { IsRecording bool `json:"isRecording"` // No description. Service ServiceName `json:"service"` // No description. }
RecordingStateChangedReply is the reply for RecordingStateChanged events.
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.
const ( ServiceNameNotSet ServiceName = "" ServiceNameBackgroundFetch ServiceName = "backgroundFetch" ServiceNameBackgroundSync ServiceName = "backgroundSync" ServiceNamePushMessaging ServiceName = "pushMessaging" ServiceNameNotifications ServiceName = "notifications" ServiceNamePaymentHandler ServiceName = "paymentHandler" ServiceNamePeriodicBackgroundSync ServiceName = "periodicBackgroundSync" )
ServiceName as enums.
func (ServiceName) String ¶
func (e ServiceName) String() string
func (ServiceName) Valid ¶
func (e ServiceName) Valid() bool
type SetRecordingArgs ¶
type SetRecordingArgs struct { ShouldRecord bool `json:"shouldRecord"` // No description. Service ServiceName `json:"service"` // No description. }
SetRecordingArgs represents the arguments for SetRecording in the BackgroundService domain.
func NewSetRecordingArgs ¶
func NewSetRecordingArgs(shouldRecord bool, service ServiceName) *SetRecordingArgs
NewSetRecordingArgs initializes SetRecordingArgs with the required arguments.
type StartObservingArgs ¶
type StartObservingArgs struct {
Service ServiceName `json:"service"` // No description.
}
StartObservingArgs represents the arguments for StartObserving in the BackgroundService domain.
func NewStartObservingArgs ¶
func NewStartObservingArgs(service ServiceName) *StartObservingArgs
NewStartObservingArgs initializes StartObservingArgs with the required arguments.
type StopObservingArgs ¶
type StopObservingArgs struct {
Service ServiceName `json:"service"` // No description.
}
StopObservingArgs represents the arguments for StopObserving in the BackgroundService domain.
func NewStopObservingArgs ¶
func NewStopObservingArgs(service ServiceName) *StopObservingArgs
NewStopObservingArgs initializes StopObservingArgs with the required arguments.