Skip to content

Commit

Permalink
fix: 修复 PWA 应用有密码时报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxi committed Nov 13, 2024
1 parent b4f0e7b commit 3fb0a3b
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions xiaomusic/static/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ self.addEventListener('install', function(e) {
})

self.addEventListener('activate', function(e) {
// 判断地址是不是需要实时去请求,是就继续发送请求
console.log('Activate event')
e.waitUntil(
Promise.all(
Expand All @@ -40,16 +39,3 @@ self.addEventListener('activate', function(e) {
)
})

self.addEventListener('fetch', function(e) {
// 匹配到缓存资源,就从缓存中返回数据
e.respondWith(
caches.match(e.request).then(function(response) {
if (response != null) {
console.log('Using cache for:', e.request.url)
return response
}
console.log('Fallback to fetch:', e.request.url)
return fetch(e.request.url)
})
)
})

0 comments on commit 3fb0a3b

Please sign in to comment.