Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
vaslabs committed Mar 28, 2021
1 parent 1ba4799 commit a5d89ae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions ui/pi-web-agent-app/src/app/pi-control.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ export class PiControlService {
currentMessage: Observable<any> = 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<any> | null {
return this.websocketService.subject;
}

eventSource() {
eventSource(): Observable<any> {
return this.currentMessage;
}

sendCommand(command: PiCommand) {
sendCommand(command: PiCommand): void {
this.commandSink()?.next(command);
}

Expand All @@ -38,13 +38,13 @@ export class PiControlService {
const observable = new Observable(
(observer: Observer<any>) => {
observer.next = event => {
this._zone.run(() => {
this.zone.run(() => {
this.sendCommand(event);
});
};

observer.error = error => {
this._zone.run( () => {
this.zone.run( () => {
observer.error(error);
});
};
Expand Down
2 changes: 1 addition & 1 deletion ui/pi-web-agent-app/src/app/system-info.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class SystemInfoService {
}


fetchSystemInfo() {
fetchSystemInfo(): void {
this.piControlService.sendCommand({Action_Type: 'DISPLAY_LIVE_INFO'});
}
}
Expand Down
6 changes: 3 additions & 3 deletions ui/pi-web-agent-app/src/app/websocket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand All @@ -29,7 +29,7 @@ export class WebsocketService {
}
}

sendMessage(event: any) {
sendMessage(event: any): void {
this.subject?.next(event);
}

Expand Down

0 comments on commit a5d89ae

Please sign in to comment.