mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 16:22:56 +02:00
Fixed Netscript interpreter memory issues by breaking promise chains in while and for loops. Improved Stock Market UI. Added a button to kill script from log display box. Added confirm() Netscript function
This commit is contained in:
@@ -1351,7 +1351,25 @@ function NetscriptFunctions(workerScript) {
|
||||
return Player.playtimeSinceLastAug;
|
||||
},
|
||||
confirm : function(txt) {
|
||||
|
||||
if (yesNoBoxOpen) {
|
||||
workerScript.scriptRef.log("ERROR: confirm() failed because a pop-up dialog box is already open");
|
||||
return false;
|
||||
}
|
||||
if (!isString(txt)) {txt = String(txt);}
|
||||
var yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton();
|
||||
yesBtn.innerHTML = "Yes";
|
||||
noBtn.innerHTML = "No";
|
||||
return new Promise(function(resolve, reject) {
|
||||
yesBtn.addEventListener("click", ()=>{
|
||||
yesNoBoxClose();
|
||||
resolve(true);
|
||||
});
|
||||
noBtn.addEventListener("click", ()=>{
|
||||
yesNoBoxClose();
|
||||
resolve(false);
|
||||
});
|
||||
yesNoBoxCreate(txt);
|
||||
});
|
||||
},
|
||||
|
||||
/* Singularity Functions */
|
||||
|
||||
Reference in New Issue
Block a user