@lvce-editor/process-explorer-worker 3.17.0 → 3.19.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/index.js +17 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2376,12 +2376,24 @@ const set$1 = rpc => {
|
|
|
2376
2376
|
state.connected = true;
|
|
2377
2377
|
};
|
|
2378
2378
|
|
|
2379
|
-
const handleMessagePort = async port => {
|
|
2379
|
+
const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
|
|
2380
|
+
const executeViewletCommand = async (uid, command, ...args) => {
|
|
2381
|
+
const fn = viewletCommandMap[`ProcessExplorer.${command}`];
|
|
2382
|
+
if (typeof fn !== 'function') {
|
|
2383
|
+
throw new TypeError(`Viewlet command not found: ${command}`);
|
|
2384
|
+
}
|
|
2385
|
+
await fn(uid, ...args);
|
|
2386
|
+
await invoke$2('Viewlet.requestRender', uid);
|
|
2387
|
+
};
|
|
2380
2388
|
const rpc = await create$6({
|
|
2381
|
-
commandMap: {
|
|
2389
|
+
commandMap: {
|
|
2390
|
+
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
2391
|
+
},
|
|
2382
2392
|
messagePort: port
|
|
2383
2393
|
});
|
|
2384
|
-
|
|
2394
|
+
if (setAsRendererProcess) {
|
|
2395
|
+
set$1(rpc);
|
|
2396
|
+
}
|
|
2385
2397
|
};
|
|
2386
2398
|
|
|
2387
2399
|
const killProcess = async (state, index = state.focusedIndex) => {
|
|
@@ -3198,6 +3210,7 @@ const setUpdateInterval = (state, updateInterval) => {
|
|
|
3198
3210
|
};
|
|
3199
3211
|
};
|
|
3200
3212
|
|
|
3213
|
+
const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
3201
3214
|
const commandMap = {
|
|
3202
3215
|
'ProcessExplorer.collapseAll': wrapCommand(collapseAll),
|
|
3203
3216
|
'ProcessExplorer.create': create$d,
|
|
@@ -3222,7 +3235,7 @@ const commandMap = {
|
|
|
3222
3235
|
'ProcessExplorer.handleContextMenu': wrapCommand(handleContextMenu),
|
|
3223
3236
|
'ProcessExplorer.handleDoubleClick': wrapCommand(handleDoubleClick),
|
|
3224
3237
|
'ProcessExplorer.handleFocus': wrapCommand(handleFocus),
|
|
3225
|
-
'ProcessExplorer.handleMessagePort':
|
|
3238
|
+
'ProcessExplorer.handleMessagePort': handleDirectMessagePort,
|
|
3226
3239
|
'ProcessExplorer.killProcess': wrapCommand(killProcess),
|
|
3227
3240
|
'ProcessExplorer.loadContent': wrapLoadContent(loadContent),
|
|
3228
3241
|
'ProcessExplorer.refresh': wrapCommand(refresh),
|