Didn't make the #ChromeDevSummit this year? Catch all the content (and more!) in the Chrome Dev Summit 2019 playlist on our Chrome Developers YouTube Channel.

Namespace: broadcastUpdate

Classes

Method

broadcastUpdate

async   static

broadcastUpdate(options)

You would not normally call this method directly; it's called automatically by an instance of the BroadcastCacheUpdate class. It's exposed here for the benefit of developers who would rather not use the full BroadcastCacheUpdate implementation.

Calling this will dispatch a message on the provided Broadcast Channel to notify interested subscribers about a change to a cached resource.

The message that's posted has a formation inspired by the Flux standard action format like so:

{
  type: 'CACHE_UPDATED',
  meta: 'workbox-broadcast-update',
  payload: {
    cacheName: 'the-cache-name',
    updatedURL: 'https://example.com/'
  }
}

(Usage of Flux itself is not at all required.)

Parameter

options

Object

Values in options have the following properties:

Parameter

cacheName

string

The name of the cache in which the updated Response was stored.

url

string

The URL associated with the updated Response.

channel

Optional

BroadcastChannel

The BroadcastChannel to use. If no channel is set or the browser doesn't support the BroadcastChannel api, then an attempt will be made to postMessage each window client.