mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-06 05:17:37 +01:00
28 lines
693 B
TypeScript
28 lines
693 B
TypeScript
import { RunningScript } from "src/Script/RunningScript";
|
|
import { WorkerScript } from "./WorkerScript";
|
|
|
|
export const recentScripts: RecentScript[] = [];
|
|
|
|
export function AddRecentScript(workerScript: WorkerScript): void {
|
|
if (recentScripts.find((r) => r.pid === workerScript.pid)) return;
|
|
recentScripts.unshift({
|
|
filename: workerScript.name,
|
|
args: workerScript.args,
|
|
pid: workerScript.pid,
|
|
timestamp: new Date(),
|
|
|
|
runningScript: workerScript.scriptRef,
|
|
});
|
|
while (recentScripts.length > 50) {
|
|
recentScripts.pop();
|
|
}
|
|
}
|
|
|
|
export interface RecentScript {
|
|
filename: string;
|
|
args: string[];
|
|
pid: number;
|
|
timestamp: Date;
|
|
runningScript: RunningScript;
|
|
}
|