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:
danielyxie
2017-11-02 16:47:09 -05:00
parent 52967d7f9d
commit bc6f0da677
15 changed files with 753 additions and 354 deletions
+10 -1
View File
@@ -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};