@lvce-editor/process-explorer-worker 3.17.0 → 3.18.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.
Files changed (2) hide show
  1. package/index.js +14 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2376,9 +2376,19 @@ const set$1 = rpc => {
2376
2376
  state.connected = true;
2377
2377
  };
2378
2378
 
2379
- const handleMessagePort = async port => {
2379
+ const handleMessagePort = async (port, viewletCommandMap) => {
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
  set$1(rpc);
@@ -3198,6 +3208,7 @@ const setUpdateInterval = (state, updateInterval) => {
3198
3208
  };
3199
3209
  };
3200
3210
 
3211
+ const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
3201
3212
  const commandMap = {
3202
3213
  'ProcessExplorer.collapseAll': wrapCommand(collapseAll),
3203
3214
  'ProcessExplorer.create': create$d,
@@ -3222,7 +3233,7 @@ const commandMap = {
3222
3233
  'ProcessExplorer.handleContextMenu': wrapCommand(handleContextMenu),
3223
3234
  'ProcessExplorer.handleDoubleClick': wrapCommand(handleDoubleClick),
3224
3235
  'ProcessExplorer.handleFocus': wrapCommand(handleFocus),
3225
- 'ProcessExplorer.handleMessagePort': handleMessagePort,
3236
+ 'ProcessExplorer.handleMessagePort': handleDirectMessagePort,
3226
3237
  'ProcessExplorer.killProcess': wrapCommand(killProcess),
3227
3238
  'ProcessExplorer.loadContent': wrapLoadContent(loadContent),
3228
3239
  'ProcessExplorer.refresh': wrapCommand(refresh),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/process-explorer-worker",
3
- "version": "3.17.0",
3
+ "version": "3.18.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",