As a title!
Many threads introduce the use of ES7 Async Await. What are benefits of ES7 Async Await over Meteor.wrapAsync?
As a title!
Many threads introduce the use of ES7 Async Await. What are benefits of ES7 Async Await over Meteor.wrapAsync?
The main benefit for me is to make the code which runs on the server consistent with the client. Both server and client can be transpiled from async/await
, where Fibers (Meteor.wrapAsync) only work on the server. This means you have write your code (particularly method and publication code) differently for server and client when they must handle async operations.
Better to have one way to do it that works on both server and client, and to me async/await
is it.
I’ll add ecosystem adoption: there’s much more traction behind promises than fibers/futures.
Aren’t async/await compiled to meteor promises which use fibers on the server?
I have read the same - that async/await gets compiled to meteor promises/fibers on the server, but it’s hard to find concrete examples of how to do this.