sandboxedjs 0.1.44 → 0.1.45
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.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/service-worker.js +12 -0
- package/dist/service-worker.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28820,7 +28820,9 @@ async function createPreview(box, options = {}) {
|
|
|
28820
28820
|
target.postMessage({ type: "sandboxedjs:connect" }, [channel.port2]);
|
|
28821
28821
|
};
|
|
28822
28822
|
const onWorkerMessage = (event) => {
|
|
28823
|
-
|
|
28823
|
+
const type = event.data?.type;
|
|
28824
|
+
if (type === "sandboxedjs:host-needed") connect();
|
|
28825
|
+
if (type === "sandboxedjs:stale") options.onStale?.();
|
|
28824
28826
|
};
|
|
28825
28827
|
navigator.serviceWorker.addEventListener("message", onWorkerMessage);
|
|
28826
28828
|
connect();
|