v1.0 with SW PWA enabled
This commit is contained in:
18
frontend/node_modules/workbox-recipes/warmStrategyCache.js
generated
vendored
Normal file
18
frontend/node_modules/workbox-recipes/warmStrategyCache.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
import './_version.js';
|
||||
/**
|
||||
* @memberof workbox-recipes
|
||||
|
||||
* @param {Object} options
|
||||
* @param {string[]} options.urls Paths to warm the strategy's cache with
|
||||
* @param {Strategy} options.strategy Strategy to use
|
||||
*/
|
||||
function warmStrategyCache(options) {
|
||||
self.addEventListener('install', (event) => {
|
||||
const done = options.urls.map((path) => options.strategy.handleAll({
|
||||
event,
|
||||
request: new Request(path),
|
||||
})[1]);
|
||||
event.waitUntil(Promise.all(done));
|
||||
});
|
||||
}
|
||||
export { warmStrategyCache };
|
||||
Reference in New Issue
Block a user