我在这个视图中有一个间隔
var QuestionsView = Backbone.View.extend({
render: function(){
var view = this;
this.updateQuestionsIntervalId = setInterval(function() {view.refreshQuestionLists()}, 3000);
),
refreshQuestionLists: function() {
this.questions.fetch({
...
});
},
navigateAway: function() {
clearInterval(this.updateQuestionsIntervalId);
}
});
理想情况下,我想QuestionView.navigateAway()
在路线改变时跑步。无论如何我可以做到这一点吗?
谢谢