bitburner-src/src/RemoteFileAPI/RemoteFileAPI.ts

16 lines
490 B
TypeScript
Raw Normal View History

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