This repository has been archived on 2025-07-07. You can view files and clone it, but cannot push or open issues or pull requests.
Files
eternos/frontend/node_modules/workbox-recipes/warmStrategyCache.js
2025-01-13 09:33:52 +03:00

19 lines
542 B
JavaScript

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 };