Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper function to "promisify" method calls #2126

Closed
jykae opened this issue Feb 15, 2017 · 3 comments
Closed

Helper function to "promisify" method calls #2126

jykae opened this issue Feb 15, 2017 · 3 comments

Comments

@jykae
Copy link
Contributor

jykae commented Feb 15, 2017

Consider adding helper function to core helper functions, use of Promises would make chained Meteor calls easier to read.

Reference: https://forums.meteor.com/t/start-using-async-await-instead-of-promises-and-callbacks/17037/52

@bajiat bajiat added the icebox label Feb 15, 2017
@jykae
Copy link
Contributor Author

jykae commented Feb 17, 2017

@mauriciovieira
Copy link
Contributor

This could be useful especially in callback chained functions we have inside our core.

@marla-singer
Copy link
Contributor

Close this issue because the helper function is done

// Validates Promisify Meteor.call, for better response handling.
export default function promisifyCall (...args) {
return new Promise((resolve, reject) => {
// Call function with arguments and callback function
Meteor.call(...args, (err, response) => {
return err ? reject(err) : resolve(response);
});
});
}

@ghost ghost removed the icebox label Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants