Yes I already read some of the answers here but I somehow could not solve my problem which is the following:
I need to wait for the result of an async call.
function clientSideFunction(){ // cannot be async
const waitForResult = callServer(); // no await here because clientSidefunction cannot be async
return waitForResult; // must be called after callServer
}
async function callServer() { // need to get rid of async keyword
const result = await new Promise((resolve, reject) => Meteor.call('someServerSideFunction', (error, result) => {
if (error) return reject(error);
resolve(result);
}));
return result;
}
I hope it's clear what I try to achieve.
Basically, I want to wait for the result to be ready before I continue the code execution after calling the callServer
function.
It must not be async-await if there are other ways (promises).