【发布时间】:2015-06-11 16:49:09
【问题描述】:
我正在查看此演示文稿building large meteor applications,我喜欢 wrapMethod() 的想法,但我似乎无法像示例中那样使用它。
这是我的代码。
Meteor.methods({
'EX.Accounts.Methods.updateProfileData' : function(userId, firstName, secondName) {
check([firstName, secondName], [String]);
Meteor.users.update(userId, {
$set: {
'profile.firstName': firstName,
'profile.lastName': secondName,
'profile.isRegisted': true
}
});
}
});
EX.Accounts.Methods.updateUserProfile = EX.wrapMethod('EX.Accounts.Methods.updateProfileData');
但是我收到了这个错误。
TypeError: Object # has no method 'wrapMethod'
我遗漏了一些我知道的东西,但找不到任何关于这个"wrapMethod"的信息
更新
也可以试试
_.extend(EX.Accounts.Methods,{
updateUserProfile : EX.Accounts.Methods.updateProfileData
});
这不会返回错误,但我没有在全局命名空间上看到该方法。
EX.Accounts.Methods 明确无方法。
【问题讨论】:
标签: javascript methods meteor