Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const init = async () => {
// Instantiating the Workbox instance adds an event listener to
// `navigator.serviceWorker`, which will be undefined in older browsers.
wb = new Workbox('/sw.js');
addNavigationReportListener();
addFirstInstalledListener();
addCacheUpdateListener();
addSWUpdateListener();
const {log} = await import('./log');
log.awaitBeforeSending(setSiteVersionOrTimeout());
log.awaitBeforeSending(setNavigationCacheOrTimeout());
// Calling register must happen after all presend dependencies get added.
await wb.register();
};