現在の日付 (時刻ではなく日のみ) が変更されたときに Backbone.js イベントをトリガーする簡単な方法はありますか?
質問する
1542 次
3 に答える
2
定期的にチェックするよりも良い考えはありません:
var lastCheckedDate = new Date();
setInterval(function () {
var d = new Date();
//TODO: check whether the day in d and lastCheckedDate are the same or not
//TODO: if not, trigger event
lastCheckedDate = d;
}, 10000); //this will check in every 10 seconds
于 2013-05-10T00:05:29.190 に答える