simplified monitor connection API.

we have one connenction per editor anyways.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta
2019-12-03 17:19:32 +01:00
parent 80549db289
commit a4e5e65286
6 changed files with 195 additions and 208 deletions

View File

@@ -202,7 +202,7 @@ export class MonitorWidget extends ReactWidget {
protected onBeforeDetach(msg: Message): void {
super.onBeforeDetach(msg);
if (this.connection.connectionId) {
if (this.connection.connected) {
this.connection.disconnect();
}
}
@@ -294,9 +294,8 @@ export class MonitorWidget extends ReactWidget {
protected readonly onSend = (value: string) => this.doSend(value);
protected async doSend(value: string) {
const { connectionId } = this.connection;
if (connectionId) {
this.monitorService.send(connectionId, value + this.model.lineEnding);
if (this.connection.connected) {
this.monitorService.send(value + this.model.lineEnding);
}
}