Is it possible? How to do this? When clicking on a button, I call function1. If the condition is true (i==1), the function1 pauses and the following code will only be executed after function2 is totally executed. Example:
function1(i){
//some code here
if(i == 1){
function2(i); // call function2 and waits the return to continue
}
//the following code
}
function2(i){
//do something here and returns
}
Here you go:
In case you meant that
function2is actually async in some manner: