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

View File

@@ -33,9 +33,9 @@ export class WorkerScript {
delay: number | null = null;
/**
* Holds the Promise resolve() function for when the script is "blocked" by an async op
* Holds the Promise reject() function while the script is "blocked" by an async op
*/
delayResolve?: () => void;
delayReject?: (reason?: any) => void;
/**
* Stores names of all functions that have logging disabled