Constructor

BroadcastCacheUpdate

new BroadcastCacheUpdate(options)

Construct a BroadcastCacheUpdate instance with a specific channelName to broadcast messages on

Parameter

options

Object

Values in options have the following properties:

Parameter

headersToCheck

Optional

Array of string

A list of headers that will be used to determine whether the responses differ.

channelName

Optional

string

The name that will be used . when creating the BroadcastChannel, which defaults to 'workbox' (the channel name used by the workbox-window package).

deferNoticationTimeout

Optional

string

The amount of time to wait for a ready message from the window on navigation requests before sending the update.

Method

notifyIfUpdated

notifyIfUpdated(options) returns Promise

Compare two Responses and send a message via the Broadcast Channel API if they differ.

Neither of the Responses can be opaque.

Parameter

options

Object

Values in options have the following properties:

Parameter

oldResponse

Response

Cached response to compare.

newResponse

Response

Possibly updated response to compare.

url

string

The URL of the request.

cacheName

string

Name of the cache the responses belong to. This is included in the broadcast message.

event

Optional

Event

event An optional event that triggered this possible cache update.

Returns

Promise Resolves once the update is sent.