diff --git a/ui/pi-web-agent-app/src/app/pi-control.service.ts b/ui/pi-web-agent-app/src/app/pi-control.service.ts index 26afc054..fe4ef15b 100644 --- a/ui/pi-web-agent-app/src/app/pi-control.service.ts +++ b/ui/pi-web-agent-app/src/app/pi-control.service.ts @@ -14,21 +14,21 @@ export class PiControlService { currentMessage: Observable = this.messageSource.asObservable(); constructor( - private _zone: NgZone, + private zone: NgZone, private websocketService: WebsocketService ) { this.websocketService.connect((next: any) => this.messageSource.next(next)); } - commandSink() { + commandSink(): Subject | null { return this.websocketService.subject; } - eventSource() { + eventSource(): Observable { return this.currentMessage; } - sendCommand(command: PiCommand) { + sendCommand(command: PiCommand): void { this.commandSink()?.next(command); } @@ -38,13 +38,13 @@ export class PiControlService { const observable = new Observable( (observer: Observer) => { observer.next = event => { - this._zone.run(() => { + this.zone.run(() => { this.sendCommand(event); }); }; observer.error = error => { - this._zone.run( () => { + this.zone.run( () => { observer.error(error); }); }; diff --git a/ui/pi-web-agent-app/src/app/system-info.service.ts b/ui/pi-web-agent-app/src/app/system-info.service.ts index df3952ce..90f978c9 100644 --- a/ui/pi-web-agent-app/src/app/system-info.service.ts +++ b/ui/pi-web-agent-app/src/app/system-info.service.ts @@ -12,7 +12,7 @@ export class SystemInfoService { } - fetchSystemInfo() { + fetchSystemInfo(): void { this.piControlService.sendCommand({Action_Type: 'DISPLAY_LIVE_INFO'}); } } diff --git a/ui/pi-web-agent-app/src/app/websocket.service.ts b/ui/pi-web-agent-app/src/app/websocket.service.ts index f294ac90..d1938ae3 100644 --- a/ui/pi-web-agent-app/src/app/websocket.service.ts +++ b/ui/pi-web-agent-app/src/app/websocket.service.ts @@ -11,12 +11,12 @@ export class WebsocketService { constructor() { } - private url() { + private url(): string { const protocol = window.location.protocol.replace('http', 'ws'); const host = window.location.host; return `${protocol}//${host}/api/control/stream`; } - public connect(subscriber: (next: any) => void) { + public connect(subscriber: (next: any) => void): void { try { if (!this.subject) { console.log(`Connecting to ${this.url()} for the first time`); @@ -29,7 +29,7 @@ export class WebsocketService { } } - sendMessage(event: any) { + sendMessage(event: any): void { this.subject?.next(event); }