Merge pull request #3301 from danielyxie/dev

Fix toasts
This commit is contained in:
hydroflame 2022-03-30 19:09:37 -04:00 committed by GitHub
commit 21f0426e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -2263,10 +2263,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
updateDynamicRam("alert", getRamCost(Player, "alert")); updateDynamicRam("alert", getRamCost(Player, "alert"));
dialogBoxCreate(message); dialogBoxCreate(message);
}, },
toast: function (_message: unknown, _variant: unknown = "success", _duration: unknown = 2000): void { toast: function (_message: unknown, _variant: unknown = "success", duration: any = 2000): void {
const message = helper.string("toast", "message", _message); const message = helper.string("toast", "message", _message);
const variant = helper.string("toast", "variant", _variant); const variant = helper.string("toast", "variant", _variant);
const duration = helper.number("toast", "duration", _duration);
updateDynamicRam("toast", getRamCost(Player, "toast")); updateDynamicRam("toast", getRamCost(Player, "toast"));
if (!["success", "info", "warning", "error"].includes(variant)) if (!["success", "info", "warning", "error"].includes(variant))
throw new Error(`variant must be one of "success", "info", "warning", or "error"`); throw new Error(`variant must be one of "success", "info", "warning", or "error"`);