mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 01:53:48 +01:00
added logic to pick up log when its closed via event emotter
This commit is contained in:
parent
ca02bdefd1
commit
7271f37ec5
@ -18,6 +18,7 @@ import { Theme } from "@mui/material";
|
|||||||
import { findRunningScript } from "../../Script/ScriptHelpers";
|
import { findRunningScript } from "../../Script/ScriptHelpers";
|
||||||
import { Player } from "../../Player";
|
import { Player } from "../../Player";
|
||||||
import { debounce } from "lodash";
|
import { debounce } from "lodash";
|
||||||
|
import { WorkerScriptStartStopEventEmitter } from "../../Netscript/WorkerScriptStartStopEventEmitter";
|
||||||
|
|
||||||
let layerCounter = 0;
|
let layerCounter = 0;
|
||||||
|
|
||||||
@ -128,6 +129,23 @@ function LogWindow(props: IProps): React.ReactElement {
|
|||||||
setRerender((old) => !old);
|
setRerender((old) => !old);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(
|
||||||
|
() =>
|
||||||
|
WorkerScriptStartStopEventEmitter.subscribe(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
const server = GetServer(script.server);
|
||||||
|
if (server === null) return;
|
||||||
|
const exisitingScript = findRunningScript(script.filename, script.args, server);
|
||||||
|
if (exisitingScript) {
|
||||||
|
exisitingScript.logs = script.logs.concat(exisitingScript.logs)
|
||||||
|
setScript(exisitingScript)
|
||||||
|
}
|
||||||
|
rerender();
|
||||||
|
}, 1000)
|
||||||
|
}),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
updateLayer();
|
updateLayer();
|
||||||
const id = setInterval(rerender, 1000);
|
const id = setInterval(rerender, 1000);
|
||||||
|
Loading…
Reference in New Issue
Block a user