swpp-backends 2.0.6 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/resources/sw-template.js +13 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const VersionAnalyzer_1 = require("./VersionAnalyzer");
|
|
|
10
10
|
const DomBuilder_1 = require("./DomBuilder");
|
|
11
11
|
// noinspection JSUnusedGlobalSymbols
|
|
12
12
|
exports.default = {
|
|
13
|
-
version: '2.0.
|
|
13
|
+
version: '2.0.7',
|
|
14
14
|
cache: {
|
|
15
15
|
readEjectData: Utils_1.readEjectData, readUpdateJson: Variant_1.readUpdateJson,
|
|
16
16
|
readRules: Variant_1.readRules, readMergeVersionMap: Variant_1.readMergeVersionMap,
|
|
@@ -18,15 +18,18 @@
|
|
|
18
18
|
self.addEventListener('install', () => {
|
|
19
19
|
self.skipWaiting()
|
|
20
20
|
const escape = '@$$[escape]'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
oldVersion.escape
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
if (escape) {
|
|
22
|
+
dbVersion.read().then(oldVersion => {
|
|
23
|
+
if (oldVersion && oldVersion.escape !== escape) {
|
|
24
|
+
oldVersion.escape = escape
|
|
25
|
+
dbVersion.write(oldVersion)
|
|
26
|
+
// noinspection JSUnresolvedVariable
|
|
27
|
+
caches.delete(CACHE_NAME)
|
|
28
|
+
.then(() => clients.matchAll())
|
|
29
|
+
.then(list => list.forEach(client => client.postMessage({type: 'escape'})))
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
}
|
|
30
33
|
})
|
|
31
34
|
|
|
32
35
|
// sw 激活后立即对所有页面生效,而非等待刷新
|
|
@@ -136,7 +139,7 @@
|
|
|
136
139
|
/** 解析字符串 */
|
|
137
140
|
const parseJson = json => dbVersion.read().then(oldVersion => {
|
|
138
141
|
const {info, global} = json
|
|
139
|
-
const newVersion = {global, local: info[0].version, escape: oldVersion?.escape}
|
|
142
|
+
const newVersion = {global, local: info[0].version, escape: oldVersion?.escape ?? 0}
|
|
140
143
|
//新用户不进行更新操作
|
|
141
144
|
if (!oldVersion) {
|
|
142
145
|
dbVersion.write(newVersion)
|