Urara-Blog/node_modules/.pnpm-store/v3/files/39/004a1d02c633432b2250260b9965ef1b594d09bc49c4e3144bd3419730f876bfa9e98d298b62c5784f050694f189947c976f00cde2673822afaf8c940682b2
2022-08-14 01:14:53 +08:00

18 lines
542 B
Text

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