swpp-backends 2.1.4 → 2.1.6

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.
@@ -12,6 +12,7 @@
12
12
  const dbVersion = {
13
13
  write: (id) => caches.open(CACHE_NAME)
14
14
  .then(cache => cache.put(CTRL_PATH, new Response(JSON.stringify(id)))),
15
+ /** @return {*} */
15
16
  read: () => caches.match(CTRL_PATH).then(response => response?.json())
16
17
  }
17
18
 
@@ -19,16 +20,17 @@
19
20
  self.skipWaiting()
20
21
  const escape = '@$$[escape]'
21
22
  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
- })
23
+ dbVersion.read()
24
+ .then(async oldVersion => {
25
+ if (oldVersion?.escape !== escape) {
26
+ oldVersion.escape = escape
27
+ await dbVersion.write(oldVersion)
28
+ // noinspection JSUnresolvedVariable
29
+ caches.delete(CACHE_NAME)
30
+ .then(() => clients.matchAll())
31
+ .then(list => list.forEach(client => client.postMessage({type: 'escape'})))
32
+ }
33
+ })
32
34
  }
33
35
  })
34
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swpp-backends",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "main": "dist/index.js",
5
5
  "typings": "types/index.d.ts",
6
6
  "description": "Generate a powerful ServiceWorker for your website.",