| [9af201e] | 1 | import { WorkboxPlugin } from 'workbox-core/types.js';
|
|---|
| 2 | import { BroadcastCacheUpdateOptions } from './BroadcastCacheUpdate.js';
|
|---|
| 3 | import './_version.js';
|
|---|
| 4 | /**
|
|---|
| 5 | * This plugin will automatically broadcast a message whenever a cached response
|
|---|
| 6 | * is updated.
|
|---|
| 7 | *
|
|---|
| 8 | * @memberof workbox-broadcast-update
|
|---|
| 9 | */
|
|---|
| 10 | declare class BroadcastUpdatePlugin implements WorkboxPlugin {
|
|---|
| 11 | private readonly _broadcastUpdate;
|
|---|
| 12 | /**
|
|---|
| 13 | * Construct a {@link workbox-broadcast-update.BroadcastUpdate} instance with
|
|---|
| 14 | * the passed options and calls its `notifyIfUpdated` method whenever the
|
|---|
| 15 | * plugin's `cacheDidUpdate` callback is invoked.
|
|---|
| 16 | *
|
|---|
| 17 | * @param {Object} [options]
|
|---|
| 18 | * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]
|
|---|
| 19 | * A list of headers that will be used to determine whether the responses
|
|---|
| 20 | * differ.
|
|---|
| 21 | * @param {string} [options.generatePayload] A function whose return value
|
|---|
| 22 | * will be used as the `payload` field in any cache update messages sent
|
|---|
| 23 | * to the window clients.
|
|---|
| 24 | */
|
|---|
| 25 | constructor(options?: BroadcastCacheUpdateOptions);
|
|---|
| 26 | /**
|
|---|
| 27 | * A "lifecycle" callback that will be triggered automatically by the
|
|---|
| 28 | * `workbox-sw` and `workbox-runtime-caching` handlers when an entry is
|
|---|
| 29 | * added to a cache.
|
|---|
| 30 | *
|
|---|
| 31 | * @private
|
|---|
| 32 | * @param {Object} options The input object to this function.
|
|---|
| 33 | * @param {string} options.cacheName Name of the cache being updated.
|
|---|
| 34 | * @param {Response} [options.oldResponse] The previous cached value, if any.
|
|---|
| 35 | * @param {Response} options.newResponse The new value in the cache.
|
|---|
| 36 | * @param {Request} options.request The request that triggered the update.
|
|---|
| 37 | * @param {Request} options.event The event that triggered the update.
|
|---|
| 38 | */
|
|---|
| 39 | cacheDidUpdate: WorkboxPlugin['cacheDidUpdate'];
|
|---|
| 40 | }
|
|---|
| 41 | export { BroadcastUpdatePlugin };
|
|---|