Skip to content

Commit 95119c6

Browse files
committed
refactor: refresh sw
1 parent d757b6c commit 95119c6

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

apps/web/public/sw.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
var preCacheName = 'pre_cache'
22
var commonCacheName = 'common_cache'
33
var preCacheFiles = []
4-
var version = "0.29.22"
4+
var version = "0.29.22.0"
55

66
var cacheRules = {
77
whiteList: [],
8-
blockList: ['worker-register.js'],
8+
blockList: [],
99
}
10+
11+
/**基础工具*/
1012
var util = {
1113
checkIsDocument: function (request) {
1214
return request.destination === 'document'
@@ -67,7 +69,7 @@ var util = {
6769
}
6870
}
6971

70-
/**静态资源,可安全使用缓存*/
72+
/**静态资源,非API请求,可安全使用缓存*/
7173
var isStatic = /\.(js|css|png|jpg|svg|woff|jpeg)/.test(request.url)
7274
var isDoucment = util.checkIsDocument(request)
7375
if (isStatic || isDoucment) {

apps/web/public/worker-register.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
function registerMain() {
2-
if(window.location.hostname==='localhost'){
3-
return
4-
}
52
navigator.serviceWorker
63
.register('/sw.js')
74
.then(function (registration) {

0 commit comments

Comments
 (0)