@cocreate/pwa 1.13.6 → 1.14.0
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/CHANGELOG.md +20 -0
- package/demo/index.html +2 -2
- package/docs/index.html +2 -2
- package/package.json +2 -2
- package/src/service-worker.js +26 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# [1.14.0](https://github.com/CoCreate-app/CoCreate-pwa/compare/v1.13.7...v1.14.0) (2023-11-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* meta name typo ([3c58a5e](https://github.com/CoCreate-app/CoCreate-pwa/commit/3c58a5ead6d509fb6cf63e57c0c3bc58e21a1e1d))
|
|
7
|
+
* update crud methods ([1b5236c](https://github.com/CoCreate-app/CoCreate-pwa/commit/1b5236c3c91610d9420f96584fbd195eb9c90078))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* debounce an array of files served from cache and send to client ([4daa134](https://github.com/CoCreate-app/CoCreate-pwa/commit/4daa1344a06049667c22fa6dab8aa229678d726e))
|
|
13
|
+
|
|
14
|
+
## [1.13.7](https://github.com/CoCreate-app/CoCreate-pwa/compare/v1.13.6...v1.13.7) (2023-11-03)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* update dependencies to the lates versions ([09ae25a](https://github.com/CoCreate-app/CoCreate-pwa/commit/09ae25a262bb16522581d1d506b5d4634d527633))
|
|
20
|
+
|
|
1
21
|
## [1.13.6](https://github.com/CoCreate-app/CoCreate-pwa/compare/v1.13.5...v1.13.6) (2023-10-25)
|
|
2
22
|
|
|
3
23
|
|
package/demo/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
6
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
7
7
|
<meta
|
|
8
|
-
|
|
8
|
+
name="viewport"
|
|
9
9
|
content="width=device-width; initial-scale=1; viewport-fit=cover" />
|
|
10
10
|
<!-- import the webpage's stylesheet -->
|
|
11
11
|
<link
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
24
24
|
<!--<hides status bar for a full screen experience omn ios only>-->
|
|
25
25
|
<meta
|
|
26
|
-
|
|
26
|
+
name="apple-mobile-web-app-status-bar-style"
|
|
27
27
|
content="black-translucent" />
|
|
28
28
|
|
|
29
29
|
<link rel="apple-touch-startup-image" href="ios-startup.png" />
|
package/docs/index.html
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
sizes="32x32"
|
|
12
12
|
href="https://cocreate.app/images/favicon.ico" />
|
|
13
13
|
<meta
|
|
14
|
-
|
|
14
|
+
name="description"
|
|
15
15
|
content="A simple HTML5 and pure javascript component. Easy configuration using data-attributes and highly styleable." />
|
|
16
16
|
<meta
|
|
17
|
-
|
|
17
|
+
name="keywords"
|
|
18
18
|
content="helper classes, utility classes, css framework, css library, inline style classes" />
|
|
19
19
|
<meta name="robots" content="index,follow" />
|
|
20
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/pwa",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "A simple pwa component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pwa",
|
|
@@ -59,6 +59,6 @@
|
|
|
59
59
|
"webpack-log": "^3.0.1"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cocreate/local-storage": "^1.10.
|
|
62
|
+
"@cocreate/local-storage": "^1.10.8"
|
|
63
63
|
}
|
|
64
64
|
}
|
package/src/service-worker.js
CHANGED
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
const cacheName = "dynamic-v2";
|
|
26
26
|
let organization_id = ""
|
|
27
27
|
let storage = true
|
|
28
|
-
let returnedFromCache = {};
|
|
29
28
|
|
|
30
29
|
const queryString = self.location.search;
|
|
31
30
|
const queryParams = new URLSearchParams(queryString);
|
|
@@ -42,7 +41,7 @@ self.addEventListener("activate", async (e) => {
|
|
|
42
41
|
|
|
43
42
|
self.addEventListener("fetch", async (e) => {
|
|
44
43
|
if (!(e.request.url.indexOf('http') === 0) || e.request.method === 'POST') return;
|
|
45
|
-
|
|
44
|
+
|
|
46
45
|
e.respondWith(
|
|
47
46
|
caches
|
|
48
47
|
.match(e.request)
|
|
@@ -51,7 +50,8 @@ self.addEventListener("fetch", async (e) => {
|
|
|
51
50
|
const organization = cacheResponse.headers.get('organization')
|
|
52
51
|
const lastModified = cacheResponse.headers.get('last-modified')
|
|
53
52
|
|
|
54
|
-
returnedFromCache[e.request.url] = { organization, lastModified }
|
|
53
|
+
// returnedFromCache[e.request.url] = { organization, lastModified }
|
|
54
|
+
sendCacheUpdate(e.request.url, organization, lastModified);
|
|
55
55
|
return cacheResponse;
|
|
56
56
|
} else {
|
|
57
57
|
const networkResponse = await fetch(e.request);
|
|
@@ -129,7 +129,7 @@ self.addEventListener('push', (event) => {
|
|
|
129
129
|
// Handle WebSocket events
|
|
130
130
|
socket.addEventListener('open', () => {
|
|
131
131
|
// The WebSocket connection is open, send the message to the server
|
|
132
|
-
socket.send(JSON.stringify({ method: 'read
|
|
132
|
+
socket.send(JSON.stringify({ method: 'object.read', array: 'files', object: { _id }, uid: '' }));
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
socket.addEventListener('message', (event) => {
|
|
@@ -160,6 +160,28 @@ self.addEventListener('push', (event) => {
|
|
|
160
160
|
);
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
+
let returnedFromCache = {};
|
|
164
|
+
let fetchTimeout = null;
|
|
165
|
+
const sendCacheUpdate = (url, organization, lastModified) => {
|
|
166
|
+
|
|
167
|
+
returnedFromCache[url] = { organization, lastModified };
|
|
168
|
+
|
|
169
|
+
if (fetchTimeout) {
|
|
170
|
+
clearTimeout(fetchTimeout);
|
|
171
|
+
}
|
|
172
|
+
const self = this
|
|
173
|
+
fetchTimeout = setTimeout(() => {
|
|
174
|
+
self.clients.matchAll().then(clients => {
|
|
175
|
+
if (clients.length > 0) {
|
|
176
|
+
clients[0].postMessage({ action: 'checkCache', returnedFromCache });
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
fetchTimeout = null;
|
|
181
|
+
returnedFromCache = {};
|
|
182
|
+
}, 500);
|
|
183
|
+
};
|
|
184
|
+
|
|
163
185
|
// self.addEventListener('backgroundfetchsuccess', (event) => {
|
|
164
186
|
// const bgFetch = event.registration;
|
|
165
187
|
|