mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 22:22:26 +01:00
Update NetscriptFunctions.ts
Just a simple change to make `alert` and `toast` reuse `argsToString` instead of `toNative` and `JSON.stringify` directly. Fixes #2015.
This commit is contained in:
parent
890b1df593
commit
e521415273
@ -2131,15 +2131,15 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
return Player.playtimeSinceLastAug;
|
||||
},
|
||||
alert: function (message: any): void {
|
||||
message = toNative(message);
|
||||
dialogBoxCreate(JSON.stringify(message));
|
||||
message = argsToString([message]);
|
||||
dialogBoxCreate(message);
|
||||
},
|
||||
toast: function (message: any, variant: any = "success"): void {
|
||||
if (!["success", "info", "warning", "error"].includes(variant))
|
||||
throw new Error(`variant must be one of "success", "info", "warning", or "error"`);
|
||||
|
||||
message = toNative(message);
|
||||
SnackbarEvents.emit(JSON.stringify(message), variant);
|
||||
message = argsToString([message]);
|
||||
SnackbarEvents.emit(message, variant);
|
||||
},
|
||||
prompt: function (txt: any): any {
|
||||
if (!isString(txt)) {
|
||||
|
Loading…
Reference in New Issue
Block a user