promise-worker-bi 6.0.0 → 6.0.1
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 +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -170,7 +170,7 @@ var PWBHost = class extends PWBBase {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
handleWorkerLock(workerLockId) {
|
|
173
|
-
navigator.locks
|
|
173
|
+
navigator.locks?.request(workerLockId, { mode: "shared" }, async () => {
|
|
174
174
|
this.dispatchEvent(new Event("close"));
|
|
175
175
|
});
|
|
176
176
|
}
|
|
@@ -189,7 +189,7 @@ var PWBHost = class extends PWBBase {
|
|
|
189
189
|
}
|
|
190
190
|
if (message[2] !== void 0) this.handleWorkerLock(message[2]);
|
|
191
191
|
const hostLockId = `pwb-host-${Math.random()}`;
|
|
192
|
-
navigator.locks
|
|
192
|
+
navigator.locks?.request(hostLockId, async () => {
|
|
193
193
|
this._postMessage([
|
|
194
194
|
3,
|
|
195
195
|
hostID,
|
|
@@ -214,7 +214,7 @@ var PWBWorker = class extends PWBBase {
|
|
|
214
214
|
constructor() {
|
|
215
215
|
super();
|
|
216
216
|
const workerLockId = `pwb-worker-${Math.random()}`;
|
|
217
|
-
navigator.locks
|
|
217
|
+
navigator.locks?.request(workerLockId, async () => {
|
|
218
218
|
this._workerLockAcquired = true;
|
|
219
219
|
this._postMessage([4, workerLockId]);
|
|
220
220
|
return new Promise(() => {});
|
|
@@ -290,7 +290,7 @@ var PWBWorker = class extends PWBBase {
|
|
|
290
290
|
_onMessage(e) {
|
|
291
291
|
const message = this._onMessageCommon(e);
|
|
292
292
|
if (!message) return;
|
|
293
|
-
if (message[0] === 3) navigator.locks
|
|
293
|
+
if (message[0] === 3) navigator.locks?.request(message[2], () => {
|
|
294
294
|
if (this._hosts.size > 1) this._hosts.delete(message[1]);
|
|
295
295
|
});
|
|
296
296
|
}
|