mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Add ESLint & Run it against the system (#4470)
This commit is contained in:
parent
43eee6b32e
commit
f789e02096
106 changed files with 1235 additions and 20242 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import { Subject } from 'rxjs';
|
||||
|
||||
import { ServerStatus, StatusEnum } from "types";
|
||||
import { ServerStatus, StatusEnum } from 'types';
|
||||
|
||||
import { KeepAliveService } from "./KeepAliveService";
|
||||
import { KeepAliveService } from './KeepAliveService';
|
||||
import { WebClient } from '../WebClient';
|
||||
|
||||
export interface WebSocketOptions {
|
||||
|
|
@ -42,7 +42,7 @@ export class WebSocketService {
|
|||
this.keepAliveService = new KeepAliveService(this);
|
||||
this.keepAliveService.disconnected$.subscribe(() => {
|
||||
this.disconnect();
|
||||
this.updateStatus(StatusEnum.DISCONNECTED, "Connection timeout");
|
||||
this.updateStatus(StatusEnum.DISCONNECTED, 'Connection timeout');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -73,15 +73,15 @@ export class WebSocketService {
|
|||
|
||||
public updateStatus(status: StatusEnum, description: string): void {
|
||||
this.status = status;
|
||||
this.statusChange$.next({status, description});
|
||||
this.statusChange$.next({ status, description });
|
||||
}
|
||||
|
||||
private createWebSocket(url: string): WebSocket {
|
||||
const socket = new WebSocket(url);
|
||||
socket.binaryType = "arraybuffer"; // We are talking binary
|
||||
socket.binaryType = 'arraybuffer';
|
||||
|
||||
socket.onopen = () => {
|
||||
this.updateStatus(StatusEnum.CONNECTED, "Connected");
|
||||
this.updateStatus(StatusEnum.CONNECTED, 'Connected');
|
||||
|
||||
this.keepAliveService.startPingLoop(this.keepalive, (pingReceived: Function) => {
|
||||
this.webClient.keepAlive(pingReceived);
|
||||
|
|
@ -91,14 +91,14 @@ export class WebSocketService {
|
|||
socket.onclose = () => {
|
||||
// dont overwrite failure messages
|
||||
if (this.status !== StatusEnum.DISCONNECTED) {
|
||||
this.updateStatus(StatusEnum.DISCONNECTED, "Connection Closed");
|
||||
this.updateStatus(StatusEnum.DISCONNECTED, 'Connection Closed');
|
||||
}
|
||||
|
||||
this.keepAliveService.endPingLoop();
|
||||
};
|
||||
|
||||
socket.onerror = () => {
|
||||
this.updateStatus(StatusEnum.DISCONNECTED, "Connection Failed");
|
||||
this.updateStatus(StatusEnum.DISCONNECTED, 'Connection Failed');
|
||||
};
|
||||
|
||||
socket.onmessage = (event: MessageEvent) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue