@lvce-editor/test-worker 2.2.0 → 3.1.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 +28 -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) {
|
|
@@ -1195,9 +1195,17 @@ const handleClickClose = async () => {
|
|
|
1195
1195
|
const handleClickCopy = async () => {
|
|
1196
1196
|
return invoke('About.handleClickCopy');
|
|
1197
1197
|
};
|
|
1198
|
+
const focusNext$6 = async () => {
|
|
1199
|
+
return invoke('About.focusNext');
|
|
1200
|
+
};
|
|
1201
|
+
const focusPrevious$4 = async () => {
|
|
1202
|
+
return invoke('About.focusPrevious');
|
|
1203
|
+
};
|
|
1198
1204
|
|
|
1199
1205
|
const TestFrameWorkComponentAbout = {
|
|
1200
1206
|
__proto__: null,
|
|
1207
|
+
focusNext: focusNext$6,
|
|
1208
|
+
focusPrevious: focusPrevious$4,
|
|
1201
1209
|
handleClickClose,
|
|
1202
1210
|
handleClickCopy,
|
|
1203
1211
|
handleClickOk,
|
|
@@ -2015,11 +2023,6 @@ const getPortTuple = () => {
|
|
|
2015
2023
|
};
|
|
2016
2024
|
};
|
|
2017
2025
|
|
|
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
2026
|
const waitForFirstEventEvent = async port => {
|
|
2024
2027
|
const {
|
|
2025
2028
|
resolve,
|
|
@@ -2046,7 +2049,13 @@ const createPortIpc = async webViewId => {
|
|
|
2046
2049
|
port2
|
|
2047
2050
|
} = getPortTuple();
|
|
2048
2051
|
const firstEventPromise = waitForFirstEventEvent(port1);
|
|
2049
|
-
|
|
2052
|
+
// TODO ask extension host worker about webview uid
|
|
2053
|
+
|
|
2054
|
+
const info = await invoke('WebView.getWebViewInfo', webViewId);
|
|
2055
|
+
const portType = 'test';
|
|
2056
|
+
await invokeAndTransfer('WebView.setPort', info.uid, port2, info.origin, portType);
|
|
2057
|
+
|
|
2058
|
+
// await SendPortToWebView.sendPortToWebView(webViewId, port2)
|
|
2050
2059
|
const firstEvent = await firstEventPromise;
|
|
2051
2060
|
if (firstEvent.data !== 'ready') {
|
|
2052
2061
|
throw new Error('unexpected first message');
|