move ctx.log to NetscriptHelpers

This commit is contained in:
Snarling
2022-08-08 15:51:50 -04:00
parent 8f8d9a1d23
commit 01e63b10a1
11 changed files with 296 additions and 234 deletions
+2 -4
View File
@@ -24,9 +24,9 @@ type WrappedNetscriptAPI = {
};
export type NetscriptContext = {
log: (message: () => string) => void;
workerScript: WorkerScript;
function: string;
functionPath: string;
};
function wrapFunction(
@@ -41,11 +41,9 @@ function wrapFunction(
throw helpers.makeRuntimeRejectMsg(workerScript, "Failure occured while wrapping netscript api");
}
const ctx = {
log: (message: () => string) => {
workerScript.log(functionPath, message);
},
workerScript,
function: functionName,
functionPath,
};
function wrappedFunction(...args: unknown[]): unknown {
helpers.checkEnvFlags(ctx);