In Meteor, how do I know on the client-side when the server-side operation is done?

前端 未结 1 520
执念已碎
执念已碎 2021-01-22 02:17

I know Meteor does client-side caching of the database for better effective performance. In the client-side Meteor method call, is there any way to know when the server-side

相关标签:
1条回答
  • 2021-01-22 02:58

    Just include a callback with your Meteor.call. The callback will be run after the server has completed processing the request.

    Template.task.events({
      'click .delete': function () {
        Meteor.call('deleteTask', this._id, function(err, result){
          if (err){
            // an error was thrown
          } else {
            // everything worked!
          }
        })
      }
    });
    
    0 讨论(0)
提交回复
热议问题