UI patches (#905)

- Show 0 clients when NT server props are undefined
- Add Prettier 

---------

Co-authored-by: Matthew Morley <matthew.morley.ca@gmail.com>
This commit is contained in:
Sriman Achanta
2023-08-31 16:56:58 -04:00
committed by GitHub
parent de394418f6
commit 08892b9e68
55 changed files with 3323 additions and 2808 deletions

View File

@@ -21,7 +21,12 @@ export class AutoReconnectingWebsocket {
* @param onData decoded websocket message data consumer. The data is automatically decoded by msgpack.
* @param onDisconnect action to run on websocket disconnection (when the websocket changes to the CLOSED state)
*/
constructor(serverAddress: string | URL, onConnect: () => void, onData: (data: IncomingWebsocketData) => void, onDisconnect: () => void) {
constructor(
serverAddress: string | URL,
onConnect: () => void,
onData: (data: IncomingWebsocketData) => void,
onDisconnect: () => void
) {
this.serverAddress = serverAddress;
this.onConnect = onConnect;
@@ -41,8 +46,8 @@ export class AutoReconnectingWebsocket {
*/
send(data, encodeData = true) {
// Only send data if the websocket is open
if(this.isConnected()) {
if(encodeData) {
if (this.isConnected()) {
if (encodeData) {
this.websocket?.send(encode(data));
} else {
this.websocket?.send(data);