【发布时间】:2015-11-06 12:36:32
【问题描述】:
Meteor.call 中是否有“加载”参数以及错误和结果参数?只是为了捕获等待事件,以便在 Meteor.call 处理时显示加载图标?如果没有,我确实有替代解决方案。只是想知道是否有比我的更有效的解决方案?谢谢!
【问题讨论】:
标签: javascript meteor
Meteor.call 中是否有“加载”参数以及错误和结果参数?只是为了捕获等待事件,以便在 Meteor.call 处理时显示加载图标?如果没有,我确实有替代解决方案。只是想知道是否有比我的更有效的解决方案?谢谢!
【问题讨论】:
标签: javascript meteor
不。您只需要在方法完成之前和之后设置一些反应状态。这是一个例子:
// 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);
});
【讨论】: