fix: properly remove caches before removing service worker (#1655)
This commit is contained in:
Родитель
deb8fe397e
Коммит
683e0857ec
|
@ -0,0 +1,15 @@
|
|||
self.addEventListener('install', function () {
|
||||
self.skipWaiting()
|
||||
})
|
||||
|
||||
self.addEventListener('activate', function (event) {
|
||||
event.waitUntil(
|
||||
caches.keys().then(function (cacheNames) {
|
||||
return Promise.all(
|
||||
cacheNames.map(function (cacheName) {
|
||||
return caches.delete(cacheName)
|
||||
})
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
|
@ -44,6 +44,7 @@ app.use(compression())
|
|||
app.use(helmet())
|
||||
app.use(sass())
|
||||
app.use('/scripts/index.js', browserify('scripts/index.js'))
|
||||
app.get('/service-worker.js', (req, res) => res.sendFile(path.resolve(__dirname, 'scripts', 'service-worker.js')))
|
||||
app.use(slashes(false))
|
||||
app.use(cookieParser())
|
||||
app.use(requestLanguage({
|
||||
|
|
Загрузка…
Ссылка в новой задаче