Home Reference Source
public class | source

ServiceWorker

Extends:

eventemitter3~EventEmitter → ServiceWorker

Constructor Summary

Public Constructor
public

Member Summary

Private Members
private
private
private

Method Summary

Public Methods
public
public

async deliverPushMessage(data: string): Promise<void>

Delivers a push message to the supplied origin from the ServiceWorker

public

async dispatchSyncEvent(tag: string, lastChance: boolean): Promise<void>

public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

async skipWaiting(): Promise<void>

Makes the ServiceWorker skip waiting

public

async start(): Promise<void>

Starts the ServiceWorker

public

Returns the ServiceWorkers status Possible status:

  • new
  • installing
  • installed
  • activating
  • activated
  • redundant
public

async stop(versionId: string): Promise<void>

Stops the ServiceWorker

public
public
public

async unregister(): Promise<void>

Un-registers the ServiceWorker

public

async updateRegistration(): Promise<void>

Updates the ServiceWorker's registrations

public
Private Methods
private
private
private

Public Constructors

public constructor(manager: WorkerManager) source

Params:

NameTypeAttributeDescription
manager WorkerManager

Private Members

private _info: ServiceWorkerInfo source

private _manager: WorkerManager source

private _origin: string source

Public Methods

public controlledClients(): Array<string> source

Return:

Array<string> (nullable: true)

public async deliverPushMessage(data: string): Promise<void> source

Delivers a push message to the supplied origin from the ServiceWorker

Params:

NameTypeAttributeDescription
data string

The data of the message

Return:

Promise<void>

See:

public async dispatchSyncEvent(tag: string, lastChance: boolean): Promise<void> source

Params:

NameTypeAttributeDescription
tag string
lastChance boolean
  • optional

Return:

Promise<void>

See:

public isActivated(): boolean source

Return:

boolean

public isActivating(): boolean source

Return:

boolean

public isDeleted(): boolean source

Return:

boolean

public isInstalled(): boolean source

Return:

boolean

public isInstalling(): boolean source

Return:

boolean

public isNew(): boolean source

Return:

boolean

public isRedundant(): boolean source

Return:

boolean

public isRunning(): boolean source

Return:

boolean

public isStarting(): boolean source

Return:

boolean

public isStopped(): boolean source

Return:

boolean

public isStopping(): boolean source

Return:

boolean

public registrationId(): string source

Return:

string

public runningStatus(): string source

Return:

string

public scopeURL(): string source

Return:

string

public scriptLastModified(): number source

Return:

number (nullable: true)

public scriptResponseTime(): number source

Return:

number (nullable: true)

public async skipWaiting(): Promise<void> source

Makes the ServiceWorker skip waiting

Return:

Promise<void>

See:

public async start(): Promise<void> source

Starts the ServiceWorker

Return:

Promise<void>

See:

public status(): string source

Returns the ServiceWorkers status Possible status:

  • new
  • installing
  • installed
  • activating
  • activated
  • redundant

Return:

string

public async stop(versionId: string): Promise<void> source

Stops the ServiceWorker

Params:

NameTypeAttributeDescription
versionId string

Return:

Promise<void>

See:

public targetId(): string source

Return:

string

public toJSON(): ServiceWorkerInfo source

public async unregister(): Promise<void> source

Un-registers the ServiceWorker

Return:

Promise<void>

See:

public async updateRegistration(): Promise<void> source

Updates the ServiceWorker's registrations

Return:

Promise<void>

See:

public versionId(): string source

Return:

string

Private Methods

private _bookKeeping(updateHow: CDPServiceWorkerRegistration | CDPServiceWorkerVersion, isVersion: boolean) source

Params:

NameTypeAttributeDescription
updateHow CDPServiceWorkerRegistration | CDPServiceWorkerVersion
isVersion boolean

private _destroyed() source

private _errorReported(error: CDPServiceWorkerErrorMessage) source

Params:

NameTypeAttributeDescription
error CDPServiceWorkerErrorMessage