2022-07-31 19:53:15 +02:00
|
|
|
import { Settings } from "../Settings/Settings";
|
2022-07-30 16:19:22 +02:00
|
|
|
import { Remote } from "./Remote";
|
|
|
|
|
|
|
|
|
2022-07-31 19:53:15 +02:00
|
|
|
let server: Remote;
|
2022-07-30 16:19:22 +02:00
|
|
|
|
2022-07-31 19:53:15 +02:00
|
|
|
export function newRemoteFileApiConnection() : void {
|
2022-07-31 20:18:11 +02:00
|
|
|
if(server == undefined) {
|
2022-07-31 19:53:15 +02:00
|
|
|
server = new Remote("localhost", Settings.RemoteFileApiPort);
|
2022-07-31 20:18:11 +02:00
|
|
|
server.startConnection();
|
|
|
|
}
|
2022-07-31 19:53:15 +02:00
|
|
|
else {
|
|
|
|
server.stopConnection();
|
|
|
|
server = new Remote("localhost", Settings.RemoteFileApiPort);
|
|
|
|
server.startConnection();
|
2022-07-30 16:19:22 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-31 19:53:15 +02:00
|
|
|
export function isRemoteFileApiConnectionLive() : boolean {
|
|
|
|
return server.connection != undefined && server.connection.readyState == 1;
|
|
|
|
}
|