mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-25 02:32:55 +02:00
Removed closePid(fn, host, ...args) and fixed closePid(pid)
This commit is contained in:
@@ -23,7 +23,7 @@ import { Settings } from "../../Settings/Settings";
|
||||
let layerCounter = 0;
|
||||
|
||||
export const LogBoxEvents = new EventEmitter<[RunningScript]>();
|
||||
export const LogBoxCloserEvents = new EventEmitter<[any, any, any[]]>();
|
||||
export const LogBoxCloserEvents = new EventEmitter<[number]>();
|
||||
export const LogBoxClearEvents = new EventEmitter<[]>();
|
||||
|
||||
interface Log {
|
||||
@@ -55,9 +55,8 @@ export function LogBoxManager(): React.ReactElement {
|
||||
//Event used by ns.closeTail to close tail windows
|
||||
useEffect(
|
||||
() =>
|
||||
LogBoxCloserEvents.subscribe((hostname: any, filename: any, stringArgs: any[]) => {
|
||||
const id = hostname + "-" + filename + stringArgs.map((x: any): string => `${x}`).join("-");
|
||||
close(id);
|
||||
LogBoxCloserEvents.subscribe((pid: number) => {
|
||||
closePid(pid);
|
||||
}),
|
||||
[],
|
||||
);
|
||||
@@ -69,11 +68,18 @@ export function LogBoxManager(): React.ReactElement {
|
||||
}),
|
||||
);
|
||||
|
||||
//Close tail windows by their id
|
||||
function close(id: string): void {
|
||||
logs = logs.filter((l) => l.id !== id);
|
||||
rerender();
|
||||
}
|
||||
|
||||
//Close tail windows by their pid
|
||||
function closePid(pid: number): void {
|
||||
logs = logs.filter((log) => log.script.pid != pid);
|
||||
rerender();
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{logs.map((log) => (
|
||||
@@ -249,14 +255,14 @@ function LogWindow(props: IProps): React.ReactElement {
|
||||
minHeight: `${minConstraints[1]}px`,
|
||||
...(minimized
|
||||
? {
|
||||
border: "none",
|
||||
margin: 0,
|
||||
maxHeight: 0,
|
||||
padding: 0,
|
||||
}
|
||||
border: "none",
|
||||
margin: 0,
|
||||
maxHeight: 0,
|
||||
padding: 0,
|
||||
}
|
||||
: {
|
||||
border: `1px solid ${Settings.theme.welllight}`,
|
||||
}),
|
||||
border: `1px solid ${Settings.theme.welllight}`,
|
||||
}),
|
||||
}}
|
||||
ref={container}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user