I call a function,
getResponse(Math.random());
doSomethingWith(someVar);
getResponse(num) {
if(num > 0.8) someVar = "whee";
if(num > 0.5) someVar = "whoo";
if(num > 0) callSomeOtherFunctionWhichDoesABunchOfDatabaseQueriesThatUsePromisesAndEventuallySetssomeVar();
}
Is there a way that I can wait for callSomeOtherFunctionWhichDoesABunchOfDatabaseQueriesThatUsePromisesAndEventuallySetssomeVar()
to finish and set someVar
? I was thinking I could also wrap the assignments of someVar
in a promise, to then make getResponse
then()
able, but that seems a bit excessive since I only have one case that I have a bunch of asynchronous work being done to determine someVar
.