File tree 4 files changed +19
-0
lines changed
arduino-ide-extension/src
4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ export class MonitorManagerProxyClientImpl
46
46
private wsPort ?: number ;
47
47
private lastConnectedBoard : BoardsConfig . Config ;
48
48
private onBoardsConfigChanged : Disposable | undefined ;
49
+ private isMonitorWidgetOpen = false ;
49
50
50
51
getWebSocketPort ( ) : number | undefined {
51
52
return this . wsPort ;
@@ -174,6 +175,14 @@ export class MonitorManagerProxyClientImpl
174
175
return this . server ( ) . getCurrentSettings ( board , port ) ;
175
176
}
176
177
178
+ setMonitorWidgetStatus ( value : boolean ) : void {
179
+ this . isMonitorWidgetOpen = value ;
180
+ }
181
+
182
+ getMonitorWidgetStatus ( ) : boolean {
183
+ return this . isMonitorWidgetOpen ;
184
+ }
185
+
177
186
send ( message : string ) : void {
178
187
if ( ! this . webSocket ) {
179
188
return ;
Original file line number Diff line number Diff line change @@ -74,6 +74,10 @@ export class MonitorWidget extends ReactWidget {
74
74
this . monitorManagerProxy . startMonitor ( ) ;
75
75
}
76
76
77
+ protected override onAfterAttach ( msg : Message ) : void {
78
+ this . monitorManagerProxy . setMonitorWidgetStatus ( this . isAttached ) ;
79
+ }
80
+
77
81
onMonitorSettingsDidChange ( settings : MonitorSettings ) : void {
78
82
this . settings = {
79
83
...this . settings ,
@@ -91,6 +95,7 @@ export class MonitorWidget extends ReactWidget {
91
95
}
92
96
93
97
override dispose ( ) : void {
98
+ this . monitorManagerProxy . setMonitorWidgetStatus ( this . isAttached ) ;
94
99
super . dispose ( ) ;
95
100
}
96
101
Original file line number Diff line number Diff line change @@ -65,6 +65,9 @@ export class PlotterFrontendContribution extends Contribution {
65
65
66
66
ipcRenderer . on ( CLOSE_PLOTTER_WINDOW , async ( ) => {
67
67
if ( ! ! this . window ) {
68
+ if ( ! this . monitorManagerProxy . getMonitorWidgetStatus ( ) ) {
69
+ this . monitorManagerProxy . disconnect ( ) ;
70
+ }
68
71
this . window = null ;
69
72
}
70
73
} ) ;
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ export interface MonitorManagerProxyClient {
37
37
isWSConnected ( ) : Promise < boolean > ;
38
38
startMonitor ( settings ?: PluggableMonitorSettings ) : Promise < void > ;
39
39
getCurrentSettings ( board : Board , port : Port ) : Promise < MonitorSettings > ;
40
+ setMonitorWidgetStatus ( value : boolean ) : void ;
41
+ getMonitorWidgetStatus ( ) : boolean ;
40
42
send ( message : string ) : void ;
41
43
changeSettings ( settings : MonitorSettings ) : void ;
42
44
}
You can’t perform that action at this time.
0 commit comments