bitburner-src/src/RemoteFileAPI/RemoteFileAPI.ts

20 lines
559 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);
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;
}