2

現在の日付 (時刻ではなく日のみ) が変更されたときに Backbone.js イベントをトリガーする簡単な方法はありますか?

4

3 に答える 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 に答える