Serial Plotter implementation (#597)

* spawn new window where to instantiate serial plotter app

* initialize serial monito web app

* connect serial plotter app with websocket

* use npm serial-plotter package

* refactor monitor connection and fix some connection issues

* fix clearConsole + refactor monitor connection

* add serial unit tests

* refactoring and cleaning code
This commit is contained in:
Alberto Iannaccone
2021-11-23 18:18:20 +01:00
committed by GitHub
parent 9863dc2f90
commit 20f7712129
40 changed files with 1670 additions and 821 deletions

View File

@@ -18,6 +18,8 @@ import {
} from '@theia/core/lib/electron-main/electron-main-application';
import { SplashServiceImpl } from '../splash/splash-service-impl';
app.commandLine.appendSwitch('disable-http-cache');
@injectable()
export class ElectronMainApplication extends TheiaElectronMainApplication {
protected _windows: BrowserWindow[] = [];
@@ -88,6 +90,35 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
this.splashService.onCloseRequested
);
}
electronWindow.webContents.on(
'new-window',
(event, url, frameName, disposition, options, additionalFeatures) => {
if (frameName === 'serialPlotter') {
event.preventDefault();
Object.assign(options, {
width: 800,
minWidth: 620,
height: 500,
minHeight: 320,
x: 100,
y: 100,
webPreferences: {
devTools: true,
nativeWindowOpen: true,
openerId: electronWindow?.webContents.id,
},
});
event.newGuest = new BrowserWindow(options);
event.newGuest.setMenu(null);
event.newGuest?.on('closed', (e: any) => {
electronWindow?.webContents.send('CLOSE_CHILD_WINDOW');
});
event.newGuest?.loadURL(url);
}
}
);
this._windows.push(electronWindow);
electronWindow.on('closed', () => {
if (electronWindow) {