Unspeakable
Unspeakable

Reputation: 247

Meteor.call 'load' parameter

Is there a 'load' parameter in Meteor.call along with error and result params? Just to capture the event of waiting so that I could display a loading icon while the Meteor.call is processing? I do have an alternate solution if there is none. Just wondering if there is or a efficient solution than mine? Thanks!

Upvotes: 0

Views: 57

Answers (1)

David Weldon
David Weldon

Reputation: 64312

Nope. You'll just need to set some reactive state before and after the method completes. Here's an example:

// We are about to start waiting on the method - use this
// to render something like a spinner.
Session.set('loading', true);

Meteor.call('someMethod', function(err, result) {
  // The method returned - stop the spinner.
  Session.set('loading', false);
  // Do something with the result.
  if (!err)
    return console.log(result);
});

Upvotes: 1

Related Questions