Using await/async in meteor


#1

What’s folks experience using async/await functions server and client side?
I know it’s still relatively new so, and requires nodejs v4.

Is using something like the package below with nodejsv4 a stable path to go yet?
https://github.com/davetemplin/mongodb-async-wrapper

Thoughts? Considerations?


#2

See:


#3

Yeah I was reading over that. Client side should be a no brainer.

Though any experince with using node v4 and the package mentioned above. As I’m pretty sure that is the only way we can use it server side correct?


#4

I haven’t used that package specifically, and depending on what it needs from Node 4, you might be out of luck. That being said you might be able to get it working with Meteor’s Promise polyfill. “Relaxed” implementations of async/await are supported server side with Meteor 1.3 using Promise.async/Promise.await. For example, crack open a meteor shell and run:

Promise.await(Promise.resolve('something happened!'));

More recent Node support is coming to Meteor soon though, so you might want to hold off a bit longer.


#5

Cool i’ll check that out.

My main issue to date is largely with making meteor method.calls, i’ve gotten half way there with the https://github.com/deanius/meteor-promise package. But ultimately would like to have the async support on the server as well.

Overall though, I get the feeling that it’s probably better to wait a bit longer for full support by meteor.

Thanks for the thoughts!