as I’m starting a new project, I want to do everything in a future proof way. I’ve searched the web a bit and I just want to make sure that I’m on the right track.
In the past I’ve used Meteor’s
Meteor.wrapAsync quite a lot to get nicer code, but this can quickly lead to situations where you have to use
Meteor.bindEnvironment for every second callback, which isn’t nice. It’s very Meteor specific as well.
Promises seem to have been around for some while through libraries, and now they’re natively available in ES6. I like the syntax and chaining
Promises can make the code really clean.
I’ve now read about async/ await, which seems to be a syntactical alternative to calling
Promises coming with ES7.
Is there any way of dealing with async code I missed? I’m wondering what to use now. I think
Promises are a safe bet, as they provide a good API and can still be used with the newer
await syntax in the future.
So that’s what I’d try outside of Meteor, but I’m not sure what I can use with it. There is a
promise package, but where can I actually use it? Does it work with
@benjamn Maybe it’s already there and I’ve just missed it, but it would be great to have an article/ overview/ guide on how to deal with async code in
Meteor > 1.3.
Have a great day