Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Meteor.methods({
- my_function: function(arg1, arg2) {
- //Call other asynchronous function and return result or throw error
- }
- });
- Meteor.methods({
- my_function: function(arg1, arg2) {
- // Set up a future
- var fut = new Future();
- // This should work for any async method
- setTimeout(function() {
- // Return the results
- fut.ret(message + " (delayed for 3 seconds)");
- }, 3 * 1000);
- // Wait for async to finish before returning
- // the result
- return fut.wait();
- }
- });
Add Comment
Please, Sign In to add comment