I have an async function
const thirdPartyFoo = async () => { ... }
What I want to do is transform this function into a synchronous function, so when I call it, it awaits to be resolved to continue.
I can't use async/await or .then because here is my case.
I have a function foo that uses the thirdPartyFoo and it's called by other places in the application. I can't use .then because I need to return a value from thirdPartyFoo, but it can't be a promise.
function foo(){
// some code
thirdPartyFoo()
// some code
return bar // this can't be a Promise
}
What I need is something similar to the ajax async: false behavior.
How can I achieve this behavior giving any async function?