I have a function in my server code(.gs) which pops up a dialog for input from user. I should wait for user input before proceeding with the function. To do this, I am using a while loop with sleep and checking for value of a key in PropertiesService. The value will be set on click of OK from the dialog.
Main.gs
function test(){
DoSomething();
SpreadsheetApp.getUi().showModalDialog(html, "Title");
while(value is not set){
Utilities.sleep(5000);
}
DoAnotherthing(value);
}
I am not happy with this solution (use of while and sleep) and was wondering if there is a better way to do this. Any pointers is appreciated.