MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / handleWSEvent

Function handleWSEvent

emain/emain.ts:87–122  ·  view source on GitHub ↗
(evtMsg: WSEventType)

Source from the content-addressed store, hash-verified

85}
86
87function handleWSEvent(evtMsg: WSEventType) {
88 fireAndForget(async () => {
89 console.log("handleWSEvent", evtMsg?.eventtype);
90 if (evtMsg.eventtype == "electron:newwindow") {
91 console.log("electron:newwindow", evtMsg.data);
92 const windowId: string = evtMsg.data;
93 const windowData: WaveWindow = (await services.ObjectService.GetObject("window:" + windowId)) as WaveWindow;
94 if (windowData == null) {
95 return;
96 }
97 const fullConfig = await RpcApi.GetFullConfigCommand(ElectronWshClient);
98 const newWin = await createBrowserWindow(windowData, fullConfig, {
99 unamePlatform,
100 isPrimaryStartupWindow: false,
101 });
102 newWin.show();
103 } else if (evtMsg.eventtype == "electron:closewindow") {
104 console.log("electron:closewindow", evtMsg.data);
105 if (evtMsg.data === undefined) return;
106 const ww = getWaveWindowById(evtMsg.data);
107 if (ww != null) {
108 ww.destroy(); // bypass the "are you sure?" dialog
109 }
110 } else if (evtMsg.eventtype == "electron:updateactivetab") {
111 const activeTabUpdate: { workspaceid: string; newactivetabid: string } = evtMsg.data;
112 console.log("electron:updateactivetab", activeTabUpdate);
113 const ww = getWaveWindowByWorkspaceId(activeTabUpdate.workspaceid);
114 if (ww == null) {
115 return;
116 }
117 await ww.setActiveTab(activeTabUpdate.newactivetabid, false);
118 } else {
119 console.log("unhandled electron ws eventtype", evtMsg.eventtype);
120 }
121 });
122}
123
124// we try to set the primary display as index [0]
125function getActivityDisplays(): ActivityDisplayType[] {

Callers 1

runWaveSrvFunction · 0.85

Calls 8

fireAndForgetFunction · 0.90
createBrowserWindowFunction · 0.90
getWaveWindowByIdFunction · 0.90
GetFullConfigCommandMethod · 0.65
GetObjectMethod · 0.45
destroyMethod · 0.45
setActiveTabMethod · 0.45

Tested by

no test coverage detected