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 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
- if (event.data?.type === "sandboxedjs:host-needed") connect();
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();