Skip to content

Commit

Permalink
Demo update
Browse files Browse the repository at this point in the history
  • Loading branch information
LostBeard committed Jul 15, 2024
1 parent 7760356 commit 160070a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions BlazorServiceWorkerDemo/Services/PWAServiceWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,8 @@ protected override async Task ServiceWorker_OnInstallAsync(ExtendableEvent e)
}
}

// optionally skip waiting and claim all clients

JS.Log(". ServiceWorker_OnInstallAsync", self);
// optionally skip waiting
await self!.SkipWaiting();
using var clients = self.Clients;
JS.Log(".. ServiceWorker_OnInstallAsync", clients);
await clients.Claim();
JS.Log("< ServiceWorker_OnInstallAsync");
}

protected override async Task ServiceWorker_OnActivateAsync(ExtendableEvent e)
Expand All @@ -94,6 +88,9 @@ await Task.WhenAll(cacheKeys
.Where(key => key.StartsWith(cacheNamePrefix) && key != cacheName)
.Select(key => caches.Delete(key)));
}
// optionally claim all clients
using var clients = self!.Clients;
await clients.Claim();
}

protected override async Task<Response> ServiceWorker_OnFetchAsync(FetchEvent e)
Expand Down

0 comments on commit 160070a

Please sign in to comment.