mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-21 05:35:45 +01:00
This should not reject with ScriptDeath, the script is not being killed. Just 'undefined' isn't great either so left a TODO about improving it
This commit is contained in:
parent
a578763b89
commit
4fd55f099b
@ -4,8 +4,10 @@ import { ScriptDeath } from "./Netscript/ScriptDeath";
|
||||
import { WorkerScript } from "./Netscript/WorkerScript";
|
||||
|
||||
export function netscriptDelay(time: number, workerScript: WorkerScript): Promise<void> {
|
||||
if (workerScript.delayReject)
|
||||
workerScript.delayReject(new ScriptDeath(workerScript));
|
||||
// Cancel any pre-existing netscriptDelay'ed function call
|
||||
// TODO: the rejection almost certainly ends up in the uncaught rejection handler.
|
||||
// Maybe reject with a stack-trace'd error message?
|
||||
if (workerScript.delayReject) workerScript.delayReject();
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
workerScript.delay = window.setTimeout(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user