Skip to content

Commit e83d2e1

Browse files
committed
update docs
1 parent efe8e40 commit e83d2e1

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

docs/static/sw.js

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
1-
// THIS FILE SHOULD NOT BE VERSION CONTROLLED
1+
importScripts('https://cdn.jsdelivr.net/npm/[email protected]/workbox/workbox-sw.js')
22

3-
// https://github.com/NekR/self-destroying-sw
3+
// --------------------------------------------------
4+
// Configure
5+
// --------------------------------------------------
46

5-
self.addEventListener('install', function (e) {
6-
self.skipWaiting()
7+
// Set workbox config
8+
workbox.setConfig({
9+
"debug": false
710
})
811

9-
self.addEventListener('activate', function (e) {
10-
self.registration.unregister()
11-
.then(function () {
12-
return self.clients.matchAll()
13-
})
14-
.then(function (clients) {
15-
clients.forEach(client => client.navigate(client.url))
16-
})
17-
})
12+
// Start controlling any existing clients as soon as it activates
13+
workbox.core.clientsClaim()
14+
15+
// Skip over the SW waiting lifecycle stage
16+
workbox.core.skipWaiting()
17+
18+
workbox.precaching.cleanupOutdatedCaches()
19+
20+
// --------------------------------------------------
21+
// Precaches
22+
// --------------------------------------------------
23+
24+
// Precache assets
25+
26+
// --------------------------------------------------
27+
// Runtime Caching
28+
// --------------------------------------------------
29+
30+
// Register route handlers for runtimeCaching
31+
workbox.routing.registerRoute(new RegExp('/vue-final-modal/_nuxt/'), new workbox.strategies.CacheFirst ({}), 'GET')
32+
workbox.routing.registerRoute(new RegExp('/vue-final-modal/'), new workbox.strategies.NetworkFirst ({}), 'GET')
File renamed without changes.

0 commit comments

Comments
 (0)