I have two functions that I want to run at the same time but I can't just let them run separately as one function contains an infinite loop while(true). And the problem with JavaScript is that if you where to run two functions, it will finish running the function before running the next one; so if I run a function with a while(true) loop, it will never move onto the next function.
If you still don't understand, here is my code:
function onOpen(){ // Google Apps Script trigger
infLoop() //how to run both of these functions at the same time?
runScript()
}
function infLoop(){ //inf loop.
while(True){
Utilities.sleep(100)
DocumentApp.getActiveDocument()
.setname("dont change this name")
}
}
function runScript(){
//code...
}