See description

Reverted ToastVariant back to an enum internally. Still exposed to player as just possible strings.
Changed all 1-line documentation comments to actually be 1-line. Moved some because they were not providing documentation for the thing they were trying to.
This commit is contained in:
Snarling
2022-10-04 06:40:10 -04:00
parent 50f14b4f58
commit aa80cf6451
109 changed files with 400 additions and 1096 deletions
+3 -9
View File
@@ -80,17 +80,11 @@ import { recentScripts } from "./Netscript/RecentScripts";
import { InternalAPI, NetscriptContext, wrapAPI } from "./Netscript/APIWrapper";
import { INetscriptExtra } from "./NetscriptFunctions/Extra";
import { ScriptDeath } from "./Netscript/ScriptDeath";
import { TypeEquality, ValuesFrom } from "./types";
// "Enums" as object
export const enums = {
toast: {
SUCCESS: "success",
WARNING: "warning",
ERROR: "error",
INFO: "info",
} as const,
};
toast: ToastVariant,
} as const;
export type NSFull = NS & INetscriptExtra;
export function NetscriptFunctions(workerScript: WorkerScript): NSFull {
@@ -1796,7 +1790,7 @@ const base: InternalAPI<NS> = {
const duration = _duration === null ? null : helpers.number(ctx, "duration", _duration);
if (!checkObjContainsValue(enums.toast, variant))
throw new Error(`variant must be one of ${Object.values(enums.toast).join(", ")}`);
SnackbarEvents.emit(message, variant, duration);
SnackbarEvents.emit(message, variant as ToastVariant, duration);
},
prompt:
(ctx: NetscriptContext) =>