initial commit
This commit is contained in:
24
app/sw.js
Normal file
24
app/sw.js
Normal file
@@ -0,0 +1,24 @@
|
||||
// This file is used to register the service worker
|
||||
// It will be automatically used by next-pwa
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(
|
||||
caches.open('siliconpin-cache-v1').then((cache) => {
|
||||
return cache.addAll([
|
||||
'/',
|
||||
'/_next/static/css/styles.css',
|
||||
'/_next/static/chunks/main.js',
|
||||
'/_next/static/chunks/pages/_app.js',
|
||||
// Add other assets you want to cache
|
||||
])
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
event.respondWith(
|
||||
caches.match(event.request).then((response) => {
|
||||
return response || fetch(event.request)
|
||||
})
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user