import WorkerManager from 'chrome-remote-interface-extra/lib/workers/WorkerManager.js'
WorkerManager
Extends:
Combination manger that juggles both Web Workers and ServiceWorkers
Constructor Summary
Public Constructor | ||
public |
constructor(client: Chrome | CRIConnection | CDPSession | Object) |
Member Summary
Private Members | ||
private |
|
|
private |
_client: Chrome | CRIConnection | CDPSession | Object |
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
Method Summary
Public Methods | ||
public |
async disableServiceWorkerDomain(): Promise<void> Disables receiving service worker events |
|
public |
async disableWorkerMonitoring(): Promise<void> Disables the monitoring of Worker creation and removal |
|
public |
async enableServiceWorkerDomain(): Promise<void> Enables receiving service worker events |
|
public |
async enableWorkerMonitoring(): Promise<void> Enables the monitoring of Worker creation and removal |
|
public |
async makeServiceWorkerSkipWaiting(scopeURL: string): Promise<void> Makes the ServiceWorker(s) under the supplied scope URL skip waiting |
|
public |
serviceWorker(registrationId: string): ServiceWorker Retrieve the ServiceWorker associated with the supplied registration id |
|
public |
|
|
public |
Returns all ServiceWorkers the manager knows about |
|
public |
async startServiceWorker(scopeURL: string): Promise<void> Starts the ServiceWorker(s) under the supplied scope URL |
|
public |
async stopAllServiceWorker(): Promise<void> |
|
public |
async stopServiceWorker(versionId: string): Promise<void> |
|
public |
async swDeliverPushMessage(pushMessage: {origin: string, registrationId: string, data: string}): Promise<void> Delivers a push message to the supplied origin from the ServiceWorker who's registrationId is the one supplied |
|
public |
async swDispatchSyncEvent(syncEvent: {origin: string, registrationId: string, tag: string, lastChance: boolean}): Promise<void> Delivers a sync event to the supplied origin from the ServiceWorker who's registrationId is the one supplied |
|
public |
async swSetForceUpdateOnPageLoad(forceUpdateOnPageLoad: boolean): Promise<void> |
|
public |
toJSON(): {serviceWorkers: Array<ServiceWorker>} |
|
public |
async unregisterServiceWorker(scopeURL: string): Promise<void> Un-registers the ServiceWorker(s) registered under the supplied scope URL |
|
public |
async updateServiceWorkerRegistration(scopeURL: string): Promise<void> Updates the ServiceWorker(s) registrations under the supplied scope URL |
|
public |
|
|
public |
|
Private Methods | ||
private |
_addWorkerConsoleMessage(event: Object, jsHandleFactory: function(arg: Object): JSHandle) |
|
private |
Clears the known service workers. |
|
private |
async _disableAutoAttach() |
|
private |
async _enableAutoAttach() |
|
private |
_ensureServiceWorkerSwapped(swappedSW: ServiceWorker, prevRegId: string) |
|
private |
_handleException(exceptionDetails: Object) |
|
private |
_isActiveServiceWorkerTarget(targetId: *): boolean |
|
private |
_onAttachedToTarget(event: *) |
|
private |
_onDetachedFromTarget(event: *) |
|
private |
_onWorkerErrorReported(errorMessage: CDPServiceWorkerErrorMessage) |
|
private |
_onWorkerRegistrationUpdated(event: {registrations: Array<CDPServiceWorkerRegistration>}) |
|
private |
_onWorkerVersionUpdated(event: {versions: Array<CDPServiceWorkerVersion>}) |
|
private |
_removeServiceWorker(registrationId: *) |
|
private |
_updateSW(updateHow: CDPServiceWorkerRegistration | CDPServiceWorkerVersion, isVersion: boolean) |
|
private |
_workerSession(targetId: string): CDPSession |
Public Constructors
public constructor(client: Chrome | CRIConnection | CDPSession | Object) source
Params:
Name | Type | Attribute | Description |
client | Chrome | CRIConnection | CDPSession | Object |
Private Members
private _client: Chrome | CRIConnection | CDPSession | Object source
private _forceUpdateState: * source
private _serviceWorkers: Map<string, ServiceWorker> source
Public Methods
public async disableServiceWorkerDomain(): Promise<void> source
Disables receiving service worker events
public async disableWorkerMonitoring(): Promise<void> source
Disables the monitoring of Worker creation and removal
public async enableServiceWorkerDomain(): Promise<void> source
Enables receiving service worker events
public async enableWorkerMonitoring(): Promise<void> source
Enables the monitoring of Worker creation and removal
public async makeServiceWorkerSkipWaiting(scopeURL: string): Promise<void> source
Makes the ServiceWorker(s) under the supplied scope URL skip waiting
Params:
Name | Type | Attribute | Description |
scopeURL | string | The scope URL for the ServiceWorker(s) |
public serviceWorker(registrationId: string): ServiceWorker source
Retrieve the ServiceWorker associated with the supplied registration id
Params:
Name | Type | Attribute | Description |
registrationId | string | The registration id of the desired ServiceWorker |
public serviceWorkers(): Array<ServiceWorker> source
Returns all ServiceWorkers the manager knows about
public async startServiceWorker(scopeURL: string): Promise<void> source
Starts the ServiceWorker(s) under the supplied scope URL
Params:
Name | Type | Attribute | Description |
scopeURL | string | The scope URL for the ServiceWorker(s) to be started |
public async stopServiceWorker(versionId: string): Promise<void> source
Params:
Name | Type | Attribute | Description |
versionId | string |
public async swDeliverPushMessage(pushMessage: {origin: string, registrationId: string, data: string}): Promise<void> source
Delivers a push message to the supplied origin from the ServiceWorker who's registrationId is the one supplied
public async swDispatchSyncEvent(syncEvent: {origin: string, registrationId: string, tag: string, lastChance: boolean}): Promise<void> source
Delivers a sync event to the supplied origin from the ServiceWorker who's registrationId is the one supplied
public async swSetForceUpdateOnPageLoad(forceUpdateOnPageLoad: boolean): Promise<void> source
Params:
Name | Type | Attribute | Description |
forceUpdateOnPageLoad | boolean |
public toJSON(): {serviceWorkers: Array<ServiceWorker>} source
public async unregisterServiceWorker(scopeURL: string): Promise<void> source
Un-registers the ServiceWorker(s) registered under the supplied scope URL
Params:
Name | Type | Attribute | Description |
scopeURL | string | The scope URL to unregister the ServiceWorker(s) for |
public async updateServiceWorkerRegistration(scopeURL: string): Promise<void> source
Updates the ServiceWorker(s) registrations under the supplied scope URL
Params:
Name | Type | Attribute | Description |
scopeURL | string | The scope URL for the ServiceWorker(s) to update their registrations |
Private Methods
private _addWorkerConsoleMessage(event: Object, jsHandleFactory: function(arg: Object): JSHandle) source
private _clearKnownWorkers() source
Clears the known service workers. Page uses this method to get rid of them when navigating
private async _disableAutoAttach() source
private async _enableAutoAttach() source
private _ensureServiceWorkerSwapped(swappedSW: ServiceWorker, prevRegId: string) source
Params:
Name | Type | Attribute | Description |
swappedSW | ServiceWorker | ||
prevRegId | string |
private _handleException(exceptionDetails: Object) source
Params:
Name | Type | Attribute | Description |
exceptionDetails | Object |
|
private _isActiveServiceWorkerTarget(targetId: *): boolean source
Params:
Name | Type | Attribute | Description |
targetId | * |
private _onAttachedToTarget(event: *) source
Params:
Name | Type | Attribute | Description |
event | * |
private _onDetachedFromTarget(event: *) source
Params:
Name | Type | Attribute | Description |
event | * |
private _onWorkerErrorReported(errorMessage: CDPServiceWorkerErrorMessage) source
Params:
Name | Type | Attribute | Description |
errorMessage | CDPServiceWorkerErrorMessage |
private _onWorkerRegistrationUpdated(event: {registrations: Array<CDPServiceWorkerRegistration>}) source
Params:
Name | Type | Attribute | Description |
event | {registrations: Array<CDPServiceWorkerRegistration>} |
private _onWorkerVersionUpdated(event: {versions: Array<CDPServiceWorkerVersion>}) source
Params:
Name | Type | Attribute | Description |
event | {versions: Array<CDPServiceWorkerVersion>} |
private _removeServiceWorker(registrationId: *) source
Params:
Name | Type | Attribute | Description |
registrationId | * |
private _updateSW(updateHow: CDPServiceWorkerRegistration | CDPServiceWorkerVersion, isVersion: boolean) source
Params:
Name | Type | Attribute | Description |
updateHow | CDPServiceWorkerRegistration | CDPServiceWorkerVersion | ||
isVersion | boolean |
|
private _workerSession(targetId: string): CDPSession source
Params:
Name | Type | Attribute | Description |
targetId | string |