преди пускането на Meteor v1.0 изпълнявах успешно този код:
onBeforeAction: function(){
if(Meteor.userId()){
Meteor.call('create_game', this.params._id, 1, function(error, result){
if (error)
console.log(error);
else{
var game_id = result;
Session.set('gamesolo_id', game_id);
}
});
}
},
waitOn: function() { return Meteor.subscribe('game', Session.get('gamesolo_id'))},
От Meteor v1.0, this.next() е необходим в куката onBeforeAction. Опитах това:
onBeforeAction: function(){
if(Meteor.userId()){
Meteor.call('create_game', this.params._id, 1, function(error, result){
if (error)
console.log(error);
else{
var game_id = result;
Session.set('gamesolo_id', game_id);
}
});
this.next();
}
},
waitOn: function() { return Meteor.subscribe('game', Session.get('gamesolo_id'))},
Но се оказва в цикъл, извикващ завинаги метода. Някаква идея как да го поправя?
this.next()
извън изразаif
- person sdooo   schedule 01.11.2014