@lvce-editor/embeds-worker 2.2.0 → 2.4.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/embedsWorkerMain.js +19 -18
- package/package.json +1 -1
package/dist/embedsWorkerMain.js
CHANGED
|
@@ -303,22 +303,11 @@ class IpcChildWithModuleWorker extends Ipc {
|
|
|
303
303
|
const wrap$f = global => {
|
|
304
304
|
return new IpcChildWithModuleWorker(global);
|
|
305
305
|
};
|
|
306
|
-
const withResolvers = () => {
|
|
307
|
-
let _resolve;
|
|
308
|
-
const promise = new Promise(resolve => {
|
|
309
|
-
_resolve = resolve;
|
|
310
|
-
});
|
|
311
|
-
return {
|
|
312
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
313
|
-
resolve: _resolve,
|
|
314
|
-
promise
|
|
315
|
-
};
|
|
316
|
-
};
|
|
317
306
|
const waitForFirstMessage = async port => {
|
|
318
307
|
const {
|
|
319
308
|
resolve,
|
|
320
309
|
promise
|
|
321
|
-
} = withResolvers();
|
|
310
|
+
} = Promise.withResolvers();
|
|
322
311
|
port.addEventListener('message', resolve, {
|
|
323
312
|
once: true
|
|
324
313
|
});
|
|
@@ -879,7 +868,7 @@ const create$1 = async ({
|
|
|
879
868
|
port2
|
|
880
869
|
} = getPortTuple();
|
|
881
870
|
// TODO call sendMessagePortToSharedProcess function instead
|
|
882
|
-
await invokeAndTransfer('IpcParent.create',
|
|
871
|
+
await invokeAndTransfer('IpcParent.create', {
|
|
883
872
|
method: 8,
|
|
884
873
|
type: 1,
|
|
885
874
|
initialCommand,
|
|
@@ -917,11 +906,15 @@ const create = async options => {
|
|
|
917
906
|
};
|
|
918
907
|
|
|
919
908
|
const launchEmbedsProcessIpc = async () => {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
909
|
+
try {
|
|
910
|
+
const ipc = await create({
|
|
911
|
+
initialCommand: 'HandleMessagePortForEmbedsProcess.handleMessagePortForEmbedsProcess'
|
|
912
|
+
});
|
|
913
|
+
handleIpc(ipc);
|
|
914
|
+
return ipc;
|
|
915
|
+
} catch (error) {
|
|
916
|
+
throw new VError(error, `Failed to launch embeds process`);
|
|
917
|
+
}
|
|
925
918
|
};
|
|
926
919
|
|
|
927
920
|
const state = {
|
|
@@ -1004,6 +997,12 @@ const forward = id => {
|
|
|
1004
997
|
const backward = id => {
|
|
1005
998
|
return invoke('ElectronWebContentsView.backward', id);
|
|
1006
999
|
};
|
|
1000
|
+
const getDomTree = id => {
|
|
1001
|
+
return invoke('ElectronWebContentsView.getDomTree', id);
|
|
1002
|
+
};
|
|
1003
|
+
const insertCss = (id, css) => {
|
|
1004
|
+
return invoke('ElectronWebContentsView.insertCss', id, css);
|
|
1005
|
+
};
|
|
1007
1006
|
const cancelNavigation = id => {
|
|
1008
1007
|
return invoke('ElectronWebContentsView.cancelNavigation', id);
|
|
1009
1008
|
};
|
|
@@ -1044,6 +1043,8 @@ const commandMap = {
|
|
|
1044
1043
|
'ElectronWebContentsView.handleContextMenu': handleContextMenu,
|
|
1045
1044
|
'ElectronWebContentsView.handleDidNavigate': handleDidNavigate,
|
|
1046
1045
|
'ElectronWebContentsView.handleTitleUpdated': handleTitleUpdated,
|
|
1046
|
+
'ElectronWebContentsView.getDomTree': getDomTree,
|
|
1047
|
+
'ElectronWebContentsView.insertCss': insertCss,
|
|
1047
1048
|
'ElectronWebContentsView.handleWillNavigate': handleWillNavigate,
|
|
1048
1049
|
'ElectronWebContentsView.hide': hide,
|
|
1049
1050
|
'ElectronWebContentsView.inspectElement': inspectElement,
|