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:
@@ -38,6 +38,14 @@ function clearEventListenersEl(el) {
|
||||
return newElem;
|
||||
}
|
||||
|
||||
//Given its id, this function removes an element AND its children
|
||||
function removeElementById(id) {
|
||||
var elem = document.getElementById(id);
|
||||
if (elem == null) {return;}
|
||||
while(elem.firstChild) {elem.removeChild(elem.firstChild);}
|
||||
elem.parentNode.removeChild(elem);
|
||||
}
|
||||
|
||||
function getRandomInt(min, max) {
|
||||
if (min > max) {return getRandomInt(max, min);}
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
@@ -67,4 +75,5 @@ function powerOfTwo(n) {
|
||||
}
|
||||
|
||||
export {sizeOfObject, addOffset, clearEventListeners, getRandomInt,
|
||||
compareArrays, printArray, powerOfTwo, clearEventListenersEl};
|
||||
compareArrays, printArray, powerOfTwo, clearEventListenersEl,
|
||||
removeElementById};
|
||||
|
||||
Reference in New Issue
Block a user