This question already has an answer here:
- Is it OK to use async/await almost everywhere? 3 answers
I am wrapping a function returning a promises into an async
function on a small helper function...
trash(filesArray, {
glob: false
})
.then(() => {
resolve(true);
}).catch((err) => {
return err;
})
…because I like to use it synchronous using the await
on the next-higher level:
async empty(liveMode, force) {
…
await helpers.trashSync(trashFiles);
// then doing further stuff...
}
Of course, this means, that I need to use the async
keyword again... (otherwise I am told await
is an ‘unknown reserved’ word or such) and if I am not mistaken, I will now need to use await
again on the next-higher level?
await memberSet.empty(true, false)
Does this “game” continue all the way up and throughout my application, so by the end, I have plenty of async
/await
's wherever there's a tiny async function contained?
Or am I simply missing the point where to stop?