bubonicfred / 4minitz

MIT License
9 stars 1 forks source link

Deprecate Meteor.callPromise #795

Closed bubonicfred closed 5 months ago

bubonicfred commented 5 months ago

Parent: #794 Our current code includes a file called promisedMethods.js. With Meteor 3.0 incoming, recent versions of Meteor 2.x have added Meteor.callAsync making this obsolete.

import { Meteor } from 'meteor/meteor';

Meteor.callPromise = function (method, ...args) {
    return new Promise(function (resolve, reject) {
        Meteor.call(method, ...args, (error, result) => {
            if (error) {
                reject(error);
            }

            resolve(result);
        });
    });
};