bitburner-src/src/RemoteFileAPI/RemoteFileAPI.ts

22 lines
601 B
TypeScript
Raw Normal View History

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