【发布时间】:2014-03-19 10:13:36
【问题描述】:
我昨天得到了这个奇怪的东西。我尝试了几次来解决这个问题。当我两次返回相同的页面时,我的应用会多次触发警报,这取决于我访问该页面的次数。我已经通过这个网站和互联网对这个“僵尸”事物和内存不足进行了一些研究,但我发现了死胡同。 2天了还不能解决这个问题。
- Backbone.js events in my views being triggering multiple times
- Backbonejs event occurring multiple times
- http://blog.bigbinary.com/2011/08/18/understanding-bind-and-bindall-in-backbone.html
- http://lostechies.com/derickbailey/2011/09/15/zombies-run-managing-page-transitions-in-backbone-apps/
我的代码
查看页面
initialize: function() {
$(window).scroll(function() {
if ($(window).scrollTop() + $(window).height() == $(document).height()) {
alert("bottom!");
}
});
this.bind("reset", this.updateView());
},
render: function() {
this.$el.html(notificationListViewTemplate);
},
updateView: function() {
console.log("clear");
this.remove();
this.render();
}
路由器
showNotificationList: function(actions) {
var notificationListView = new NotificationListView();
this.changePage(notificationListView);
},
为什么会这样?
【问题讨论】:
标签: javascript jquery backbone.js