I have a subscription inside my waitOn router hook, that takes a date as an argument:
waitOn: function() {
var t = Date.now();
var period = moment(t).subtract(1, 'days').valueOf();
return Meteor.subscribe('posts', period);
}
the problem is, calling Date.now() makes the hook rerun infinitely.
I tried using _.once from the underscore library:
var t = _.once(function () { return Date.now(); });
but I can’t get it to work. It does not return the date.