Classes

Method

broadcastUpdate

static

broadcastUpdate(channel, cacheName, url, source)

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-cache-update',
  payload: {
    cacheName: 'the-cache-name',
    updatedUrl: 'https://example.com/'
  }
}

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

Parameter

channel

BroadcastChannel

The BroadcastChannel to use.

cacheName

string

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

url

string

The URL associated with the updated Response.

source

string

A string identifying this library as the source of the update message.