mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-03-11 04:42:34 +01:00
fix a few bugs
This commit is contained in:
4
dist/vendor.bundle.js
vendored
4
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -21,28 +21,30 @@ interface Log {
|
|||||||
script: RunningScript;
|
script: RunningScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let logs: Log[] = [];
|
||||||
|
|
||||||
export function LogBoxManager(): React.ReactElement {
|
export function LogBoxManager(): React.ReactElement {
|
||||||
const [logs, setLogs] = useState<Log[]>([]);
|
const setRerender = useState(true)[1];
|
||||||
|
function rerender(): void {
|
||||||
|
setRerender((o) => !o);
|
||||||
|
}
|
||||||
useEffect(
|
useEffect(
|
||||||
() =>
|
() =>
|
||||||
LogBoxEvents.subscribe((script: RunningScript) => {
|
LogBoxEvents.subscribe((script: RunningScript) => {
|
||||||
const id = script.server + "-" + script.filename + script.args.map((x: any): string => `${x}`).join("-");
|
const id = script.server + "-" + script.filename + script.args.map((x: any): string => `${x}`).join("-");
|
||||||
if (logs.find((l) => l.id === id)) return;
|
if (logs.find((l) => l.id === id)) return;
|
||||||
setLogs((old) => {
|
logs.push({
|
||||||
return [
|
id: id,
|
||||||
...old,
|
script: script,
|
||||||
{
|
|
||||||
id: id,
|
|
||||||
script: script,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
});
|
});
|
||||||
|
rerender();
|
||||||
}),
|
}),
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
function close(id: string): void {
|
function close(id: string): void {
|
||||||
setLogs((old) => old.filter((l) => l.id !== id));
|
logs = logs.filter((l) => l.id !== id);
|
||||||
|
rerender();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Reference in New Issue
Block a user