Refactor netscriptDelay and script kill interaction

Store the Promise reject function instead of resolve in WorkerScript, since
it's only used when killing a script that's blocked in delay. And when killing
a script, reject the delay Promise with the WorkerScript as cause.
This commit is contained in:
Heikki Aitakangas
2022-01-06 02:56:10 +02:00
parent 0de588ee17
commit 59da79a427
3 changed files with 12 additions and 7 deletions
+2 -2
View File
@@ -138,8 +138,8 @@ function killNetscriptDelay(workerScript: WorkerScript): void {
if (workerScript instanceof WorkerScript) {
if (workerScript.delay) {
clearTimeout(workerScript.delay);
if (workerScript.delayResolve) {
workerScript.delayResolve();
if (workerScript.delayReject) {
workerScript.delayReject(workerScript);
}
}
}