You can await
any promise in an async
function. The code after the await
will be executed after the promise that you are awaiting finished.
This is a great alternative to classic JavaScript callbacks.
I wrote a blog about it -> https://github.com/Gameye/js-async I hope this will help you!