New goal. Making Meteor.methods and account methods promise based

I’m thinking of implementing promises into the Meteor methods and in the Accounts methods. I’ve been digging trough the core packages to see if and how and it seems do-able.

Any support for this? If that’s a yes, I will make a PR some time in the future…

Here’s my goal. Instead of this:

const register = (email, password) => {
  return new Promise((resolve, reject) => {
    Accounts.createUser({ email, password }, (error, result) => {
      if (error) {
      } else {

I want to do this:

const register = async (email, password) => {
  await Accounts.createUser({ email, password });

I have been working with methods returning promises for a while and has been great. Having support for it on the core would be nice.

Actually I though about adding this feature to the validated method package too, but I really dont export methods I call them by name, so I never did it.

Is there a reason not to use one of the “Promisifying” packages in Atmosphere for this functionality?

I think that this would lower the barrier between non Meteor developers. Its a small step into the direction of not having to use Fibers on the serverside aswell. I find having to install a package just to use Methods with promises 1 extra step too much (a small one though).

A lot of libraries seem to provide a promisified version of a function out of the box, first one to pop into my mind would be AWS SDK.

I think it would be nice, and I agree I’m not a fan of finding, evaluating and learning a random package to achieve this.

However, I’d recommend you first make a feature request here unless there is one already? Maybe start working on the PR only after some green light has been indicated by the core team.

Yea might be better indeed. Just wanted to have a feeling for if people are in fact waiting for this.