I think what you are looking for is the Tracker.nonreactive(func)
function described here. Per the documentation, you need to pass a function to this function to be executed and the result of that function will be returned by this function. Also, this function will not pay attention to any reactive data source updates in your own defined function.
I would suggest rewriting your helper function like this:
Template.foo.helpers({
info: function() {
return Tracker.nonreactive(function() {
var user = Meteor.user();
if(user && user.profile) {
return user.profile.info;
} else {
// return some other appropriate value if the if-statement above
// is not fulfilled
}
});
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…