@lvce-editor/test-worker 2.2.0 → 3.0.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/testWorkerMain.js +20 -19
- package/package.json +1 -1
package/dist/testWorkerMain.js
CHANGED
|
@@ -445,9 +445,6 @@ let id = 0;
|
|
|
445
445
|
const create$3 = () => {
|
|
446
446
|
return ++id;
|
|
447
447
|
};
|
|
448
|
-
const warn = (...args) => {
|
|
449
|
-
console.warn(...args);
|
|
450
|
-
};
|
|
451
448
|
const registerPromise = () => {
|
|
452
449
|
const id = create$3();
|
|
453
450
|
const {
|
|
@@ -460,16 +457,6 @@ const registerPromise = () => {
|
|
|
460
457
|
promise
|
|
461
458
|
};
|
|
462
459
|
};
|
|
463
|
-
const resolve = (id, response) => {
|
|
464
|
-
const fn = get(id);
|
|
465
|
-
if (!fn) {
|
|
466
|
-
console.log(response);
|
|
467
|
-
warn(`callback ${id} may already be disposed`);
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
fn(response);
|
|
471
|
-
remove(id);
|
|
472
|
-
};
|
|
473
460
|
const create$2 = (method, params) => {
|
|
474
461
|
const {
|
|
475
462
|
id,
|
|
@@ -617,6 +604,19 @@ const unwrapJsonRpcResult = responseMessage => {
|
|
|
617
604
|
}
|
|
618
605
|
throw new JsonRpcError('unexpected response message');
|
|
619
606
|
};
|
|
607
|
+
const warn = (...args) => {
|
|
608
|
+
console.warn(...args);
|
|
609
|
+
};
|
|
610
|
+
const resolve = (id, response) => {
|
|
611
|
+
const fn = get(id);
|
|
612
|
+
if (!fn) {
|
|
613
|
+
console.log(response);
|
|
614
|
+
warn(`callback ${id} may already be disposed`);
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
fn(response);
|
|
618
|
+
remove(id);
|
|
619
|
+
};
|
|
620
620
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
621
621
|
const getErrorType = prettyError => {
|
|
622
622
|
if (prettyError && prettyError.type) {
|
|
@@ -2015,11 +2015,6 @@ const getPortTuple = () => {
|
|
|
2015
2015
|
};
|
|
2016
2016
|
};
|
|
2017
2017
|
|
|
2018
|
-
const sendPortToWebView = async (webviewId, port) => {
|
|
2019
|
-
await invokeAndTransfer('Transferrable.transferToRendererProcess', webviewId, port);
|
|
2020
|
-
console.log('did send port to renderer process');
|
|
2021
|
-
};
|
|
2022
|
-
|
|
2023
2018
|
const waitForFirstEventEvent = async port => {
|
|
2024
2019
|
const {
|
|
2025
2020
|
resolve,
|
|
@@ -2046,7 +2041,13 @@ const createPortIpc = async webViewId => {
|
|
|
2046
2041
|
port2
|
|
2047
2042
|
} = getPortTuple();
|
|
2048
2043
|
const firstEventPromise = waitForFirstEventEvent(port1);
|
|
2049
|
-
|
|
2044
|
+
// TODO ask extension host worker about webview uid
|
|
2045
|
+
|
|
2046
|
+
const info = await invoke('WebView.getWebViewInfo', webViewId);
|
|
2047
|
+
const portType = 'test';
|
|
2048
|
+
await invokeAndTransfer('WebView.setPort', info.uid, port2, info.origin, portType);
|
|
2049
|
+
|
|
2050
|
+
// await SendPortToWebView.sendPortToWebView(webViewId, port2)
|
|
2050
2051
|
const firstEvent = await firstEventPromise;
|
|
2051
2052
|
if (firstEvent.data !== 'ready') {
|
|
2052
2053
|
throw new Error('unexpected first message');
|