in workbox-v4.3.1/workbox-precaching.dev.js [316:362]
async install({
event,
plugins
} = {}) {
{
if (plugins) {
assert_mjs.assert.isArray(plugins, {
moduleName: 'workbox-precaching',
className: 'PrecacheController',
funcName: 'install',
paramName: 'plugins'
});
}
}
const urlsToPrecache = [];
const urlsAlreadyPrecached = [];
const cache = await caches.open(this._cacheName);
const alreadyCachedRequests = await cache.keys();
const alreadyCachedURLs = new Set(alreadyCachedRequests.map(request => request.url));
for (const cacheKey of this._urlsToCacheKeys.values()) {
if (alreadyCachedURLs.has(cacheKey)) {
urlsAlreadyPrecached.push(cacheKey);
} else {
urlsToPrecache.push(cacheKey);
}
}
const precacheRequests = urlsToPrecache.map(url => {
return this._addURLToCache({
event,
plugins,
url
});
});
await Promise.all(precacheRequests);
{
printInstallDetails(urlsToPrecache, urlsAlreadyPrecached);
}
return {
updatedURLs: urlsToPrecache,
notUpdatedURLs: urlsAlreadyPrecached
};
}