I'm trying to get make the async calls bellow (they are async because of a external API, not my design) to run sequentially, now I managed to have foo be awaited by it's calling function but I'm having trouble awaiting for foo2 because I get the following error on the async line
JS ERROR: SyntaxError: missing ) after argument list
What am I missing?
ps: Also is there a better way to "return" a value from the callback than setting a global variable and accessing it from outside?
foo(nick) {
return new Promise((resolve, reject) async () => {
async_foo(par, [],
(c, res) => {
let par2;
try {
par2 = c.somefun(res);
} catch (e) {
logError(e, `Some error`);
return;
}
let output = await this.foo2(par2);
resolve(output);
});
});
}
foo2(par2) {
return new Promise((resolve, reject) => {
par2.asyncfun(
null, this.callback.bind(this, par2));
});
}
Thank you in advance