@lvce-editor/iframe-worker 5.16.0 → 5.17.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.
@@ -483,10 +483,10 @@ const create$4 = (method, params) => {
483
483
  };
484
484
  };
485
485
  const callbacks = Object.create(null);
486
- const set$1 = (id, fn) => {
486
+ const set$2 = (id, fn) => {
487
487
  callbacks[id] = fn;
488
488
  };
489
- const get$1 = id => {
489
+ const get$2 = id => {
490
490
  return callbacks[id];
491
491
  };
492
492
  const remove = id => {
@@ -502,7 +502,7 @@ const registerPromise = () => {
502
502
  resolve,
503
503
  promise
504
504
  } = Promise.withResolvers();
505
- set$1(id, resolve);
505
+ set$2(id, resolve);
506
506
  return {
507
507
  id,
508
508
  promise
@@ -659,7 +659,7 @@ const warn = (...args) => {
659
659
  console.warn(...args);
660
660
  };
661
661
  const resolve = (id, response) => {
662
- const fn = get$1(id);
662
+ const fn = get$2(id);
663
663
  if (!fn) {
664
664
  console.log(response);
665
665
  warn(`callback ${id} may already be disposed`);
@@ -967,20 +967,24 @@ const getAssetDir = () => {
967
967
  };
968
968
  const assetDir = getAssetDir();
969
969
 
970
- const state$1 = {
971
- rpc: undefined
970
+ const RendererWorker = 1;
971
+
972
+ const rpcs$1 = Object.create(null);
973
+ const set$1 = (id, rpc) => {
974
+ rpcs$1[id] = rpc;
975
+ };
976
+ const get$1 = id => {
977
+ return rpcs$1[id];
972
978
  };
979
+
973
980
  const invoke$4 = (method, ...params) => {
974
- const rpc = state$1.rpc;
981
+ const rpc = get$1(RendererWorker);
975
982
  return rpc.invoke(method, ...params);
976
983
  };
977
984
  const invokeAndTransfer$3 = (method, ...params) => {
978
- const rpc = state$1.rpc;
985
+ const rpc = get$1(RendererWorker);
979
986
  return rpc.invokeAndTransfer(method, ...params);
980
987
  };
981
- const setRpc = rpc => {
982
- state$1.rpc = rpc;
983
- };
984
988
 
985
989
  const invoke$3 = async (method, ...params) => {
986
990
  return invoke$4('WebView.compatExtensionHostWorkerInvoke', method, ...params);
@@ -1752,7 +1756,7 @@ const listen = async () => {
1752
1756
  const rpc = await WebWorkerRpcClient.create({
1753
1757
  commandMap: commandMap
1754
1758
  });
1755
- setRpc(rpc);
1759
+ set$1(RendererWorker, rpc);
1756
1760
  };
1757
1761
 
1758
1762
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/iframe-worker",
3
- "version": "5.16.0",
3
+ "version": "5.17.0",
4
4
  "description": "Web Worker to manage creation and lifecycle of iframes in Lvce Editor",
5
5
  "main": "dist/iframeWorkerMain.js",
6
6
  "type": "module",