@lvce-editor/panel-worker 2.9.0 → 2.10.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/panelWorkerMain.js +14 -3
- package/package.json +1 -1
package/dist/panelWorkerMain.js
CHANGED
|
@@ -1636,9 +1636,19 @@ const set = rpc => {
|
|
|
1636
1636
|
state.connected = true;
|
|
1637
1637
|
};
|
|
1638
1638
|
|
|
1639
|
-
const handleMessagePort = async port => {
|
|
1639
|
+
const handleMessagePort = async (port, viewletCommandMap) => {
|
|
1640
|
+
const executeViewletCommand = async (uid, command, ...args) => {
|
|
1641
|
+
const fn = viewletCommandMap[`Panel.${command}`];
|
|
1642
|
+
if (typeof fn !== 'function') {
|
|
1643
|
+
throw new TypeError(`Viewlet command not found: ${command}`);
|
|
1644
|
+
}
|
|
1645
|
+
await fn(uid, ...args);
|
|
1646
|
+
await invoke$1('Viewlet.requestRender', uid);
|
|
1647
|
+
};
|
|
1640
1648
|
const rpc = await create$4({
|
|
1641
|
-
commandMap: {
|
|
1649
|
+
commandMap: {
|
|
1650
|
+
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
1651
|
+
},
|
|
1642
1652
|
messagePort: port
|
|
1643
1653
|
});
|
|
1644
1654
|
set(rpc);
|
|
@@ -2418,6 +2428,7 @@ const selectName = async (state, name) => {
|
|
|
2418
2428
|
return selectIndex(state, index);
|
|
2419
2429
|
};
|
|
2420
2430
|
|
|
2431
|
+
const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
|
|
2421
2432
|
const commandMap = {
|
|
2422
2433
|
'Panel.create': create,
|
|
2423
2434
|
'Panel.diff2': diff2,
|
|
@@ -2427,7 +2438,7 @@ const commandMap = {
|
|
|
2427
2438
|
'Panel.handleClickMaximize': wrapCommand(handleClickMaximize),
|
|
2428
2439
|
'Panel.handleClickUnmaximize': wrapCommand(handleClickUnmaximize),
|
|
2429
2440
|
'Panel.handleFilterInput': wrapCommand(handleFilterInput),
|
|
2430
|
-
'Panel.handleMessagePort':
|
|
2441
|
+
'Panel.handleMessagePort': handleDirectMessagePort,
|
|
2431
2442
|
'Panel.handlePanelLayoutChanged': wrapCommand(handlePanelLayoutChanged),
|
|
2432
2443
|
'Panel.handleProblemsSummaryChange': wrapCommand(handleProblemsSummaryChange),
|
|
2433
2444
|
'Panel.loadContent': wrapCommand(loadContent),
|