@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.
- package/dist/iframeWorkerMain.js +16 -12
- package/package.json +1 -1
package/dist/iframeWorkerMain.js
CHANGED
|
@@ -483,10 +483,10 @@ const create$4 = (method, params) => {
|
|
|
483
483
|
};
|
|
484
484
|
};
|
|
485
485
|
const callbacks = Object.create(null);
|
|
486
|
-
const set$
|
|
486
|
+
const set$2 = (id, fn) => {
|
|
487
487
|
callbacks[id] = fn;
|
|
488
488
|
};
|
|
489
|
-
const get$
|
|
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$
|
|
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$
|
|
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
|
|
971
|
-
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
1759
|
+
set$1(RendererWorker, rpc);
|
|
1756
1760
|
};
|
|
1757
1761
|
|
|
1758
1762
|
const main = async () => {
|