@lvce-editor/running-extensions-view 1.23.0 → 1.25.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.
|
@@ -1973,12 +1973,24 @@ const set = rpc => {
|
|
|
1973
1973
|
state.connected = true;
|
|
1974
1974
|
};
|
|
1975
1975
|
|
|
1976
|
-
const handleMessagePort = async port => {
|
|
1976
|
+
const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
|
|
1977
|
+
const executeViewletCommand = async (uid, command, ...args) => {
|
|
1978
|
+
const fn = viewletCommandMap[`RunningExtensions.${command}`];
|
|
1979
|
+
if (typeof fn !== 'function') {
|
|
1980
|
+
throw new TypeError(`Viewlet command not found: ${command}`);
|
|
1981
|
+
}
|
|
1982
|
+
await fn(uid, ...args);
|
|
1983
|
+
await invoke$1('Viewlet.requestRender', uid);
|
|
1984
|
+
};
|
|
1977
1985
|
const rpc = await create$6({
|
|
1978
|
-
commandMap: {
|
|
1986
|
+
commandMap: {
|
|
1987
|
+
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
1988
|
+
},
|
|
1979
1989
|
messagePort: port
|
|
1980
1990
|
});
|
|
1981
|
-
|
|
1991
|
+
if (setAsRendererProcess) {
|
|
1992
|
+
set(rpc);
|
|
1993
|
+
}
|
|
1982
1994
|
};
|
|
1983
1995
|
|
|
1984
1996
|
const getRunningExtensions = async (assetDir, platform) => {
|
|
@@ -2656,6 +2668,7 @@ const takeHeapSnapshot = async (state, index) => {
|
|
|
2656
2668
|
return state;
|
|
2657
2669
|
};
|
|
2658
2670
|
|
|
2671
|
+
const handleDirectMessagePort = (port, setAsRendererProcess) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
2659
2672
|
const commandMap = {
|
|
2660
2673
|
'RunningExtensions.copyId': wrapCommand(copyId$1),
|
|
2661
2674
|
'RunningExtensions.create': create,
|
|
@@ -2669,7 +2682,7 @@ const commandMap = {
|
|
|
2669
2682
|
'RunningExtensions.handleBlur': wrapCommand(handleBlur),
|
|
2670
2683
|
'RunningExtensions.handleClickAt': wrapCommand(handleClickAt),
|
|
2671
2684
|
'RunningExtensions.handleContextMenu': wrapCommand(handleContextMenu),
|
|
2672
|
-
'RunningExtensions.handleMessagePort':
|
|
2685
|
+
'RunningExtensions.handleMessagePort': handleDirectMessagePort,
|
|
2673
2686
|
'RunningExtensions.loadContent': wrapCommand(loadContent),
|
|
2674
2687
|
'RunningExtensions.render2': render2,
|
|
2675
2688
|
'RunningExtensions.renderEventListeners': renderEventListeners,
|