Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

Activate service worker immediately #177

Merged
merged 2 commits into from
Nov 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Client/wwwroot/service-worker.published.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const offlineAssetsExclude = [ /^service-worker\.js$/ ];
async function onInstall(event) {
console.info('Service worker: Install');

// Activate the new service worker as soon as the old one is retired.
self.skipWaiting();

// Fetch and cache all matching items from the assets manifest
const assetsRequests = self.assetsManifest.assets
.filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url)))
Expand Down