@lls/offline 24.31.0-e7957fe5 → 24.31.0-e896bbca
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.
|
@@ -539,6 +539,11 @@ var initChannel = async (__, { ports }) => {
|
|
|
539
539
|
offlineWorker.onmessage = combineHandlers(syncHandler, onHandler);
|
|
540
540
|
offlineWorker.onclose = () => {
|
|
541
541
|
console.error("socket to ow has been closed!");
|
|
542
|
+
swSelf.clients.matchAll({ includeUncontrolled: true }).then((clientList) => {
|
|
543
|
+
for (const client of clientList) {
|
|
544
|
+
client.postMessage({ methodName: "reloadChannels" });
|
|
545
|
+
}
|
|
546
|
+
});
|
|
542
547
|
};
|
|
543
548
|
await offlineWorkerSync.ensureAppReady();
|
|
544
549
|
};
|
|
@@ -514,6 +514,7 @@ var initChannel = (__, { ports }) => {
|
|
|
514
514
|
fetchWorker.onmessage = combineHandlers(syncHandler, onHandler);
|
|
515
515
|
fetchWorker.onclose = () => {
|
|
516
516
|
console.error("socket to sw has been closed!");
|
|
517
|
+
self.postMessage({ methodName: "reloadChannels" });
|
|
517
518
|
};
|
|
518
519
|
};
|
|
519
520
|
var loadBooks = async ({ primaryOnly = false } = {}) => {
|
package/lib/index.js
CHANGED
|
@@ -146,15 +146,19 @@ var installWorker = async ({
|
|
|
146
146
|
} = {}) => {
|
|
147
147
|
const fetchWorker = await fetchWorkerPromise;
|
|
148
148
|
const configureOptions = { storage, zipBaseUrl, checkUpdates, confEnv };
|
|
149
|
+
const reloadChannels = async () => {
|
|
150
|
+
location.reload();
|
|
151
|
+
};
|
|
149
152
|
if (nativeReadFile) {
|
|
150
|
-
const wwHandler = makeSyncHandler({ nativeReadFile, nativeWriteFile, nativeListZips });
|
|
153
|
+
const wwHandler = makeSyncHandler({ reloadChannels, nativeReadFile, nativeWriteFile, nativeListZips });
|
|
151
154
|
offlineWorker.onmessage = combineHandlers(handler, wwHandler);
|
|
152
155
|
if (storage !== "native") {
|
|
153
156
|
console.warn("nativeReadFile given, ignoring storage", storage);
|
|
154
157
|
}
|
|
155
158
|
offlineWorkerSync.configure({ ...configureOptions, storage: "native" });
|
|
156
159
|
} else {
|
|
157
|
-
|
|
160
|
+
const wwHandler = makeSyncHandler({ reloadChannels });
|
|
161
|
+
offlineWorker.onmessage = combineHandlers(handler, wwHandler);
|
|
158
162
|
await offlineWorkerSync.configure(configureOptions);
|
|
159
163
|
}
|
|
160
164
|
const channel = new MessageChannel();
|
|
@@ -163,7 +167,8 @@ var installWorker = async ({
|
|
|
163
167
|
"initChannel",
|
|
164
168
|
"configure"
|
|
165
169
|
]);
|
|
166
|
-
|
|
170
|
+
const swHandler = makeSyncHandler({ reloadChannels });
|
|
171
|
+
navigator.serviceWorker.onmessage = combineHandlers(fetchWorkerHandler, swHandler);
|
|
167
172
|
await fetchWorkerSync.initChannel({ ports: [channel.port2] });
|
|
168
173
|
await fetchWorkerSync.configure({ storage, confEnv });
|
|
169
174
|
offlineWorkerSync.on("opfsProgress", () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lls/offline",
|
|
3
|
-
"version": "24.31.0-
|
|
3
|
+
"version": "24.31.0-e896bbca",
|
|
4
4
|
"description": "offline",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"vite": "7.1.11",
|
|
55
55
|
"vite-tsconfig-paths": "5.1.4",
|
|
56
56
|
"zod": "3.25.50",
|
|
57
|
-
"@lls/vitescripts": "24.31.0-
|
|
57
|
+
"@lls/vitescripts": "24.31.0-e896bbca"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"redux-persist": "6.0.0"
|