Add setting UI for port/reconnect, swap wrong API handlers

This commit is contained in:
Zoë Hoekstra
2022-07-31 19:53:15 +02:00
parent d20f621b47
commit 5fc67c328b
7 changed files with 127 additions and 52 deletions
+12 -9
View File
@@ -1,16 +1,19 @@
import { Settings } from "../Settings/Settings";
import { Remote } from "./Remote";
class RemoteFileAPI {
server : Remote;
constructor(){
this.server = new Remote("localhost", 12525);
return;
}
let server: Remote;
enable() : void {
this.server.startConnection();
export function newRemoteFileApiConnection() : void {
if(server == undefined)
server = new Remote("localhost", Settings.RemoteFileApiPort);
else {
server.stopConnection();
server = new Remote("localhost", Settings.RemoteFileApiPort);
server.startConnection();
}
}
export const RFA = new RemoteFileAPI;
export function isRemoteFileApiConnectionLive() : boolean {
return server.connection != undefined && server.connection.readyState == 1;
}