workbox. broadcastUpdate
Classes
BroadcastCacheUpdate
Uses the Broadcast Channel API to notify interested parties when a cached response has been updated.
For efficiency's sake, the underlying response bodies are not compared; only specific response headers are checked.
BroadcastCacheUpdatePlugin
This plugin will automatically broadcast a message whenever a cached response is updated.
Method
broadcastUpdate
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 |
cacheName |
string The name of the cache in which the updated
|
url |
string The URL associated with the updated |
source |
string A string identifying this library as the source of the update message. |