嗨,我遇到了这个代码的问题,并且函数sendViewedUpdatesToAnalytics在我第二次登陆视图时被触发两次,而第三次登陆时没有清除缓存。有人能帮我吗。感谢
initialize : function(){
this.app.events.on('page:ready', this.onPageReady, this);
},
'onPageReady': function(){
var sendViewedUpdatesToAnalytics = function(e){
iCount++;
viewportTop = $(document).scrollTop();
e.preventDefault();
if( updateOffset >= viewportTop && updateOffset <= viewportTop + windowHeight ){
console.log('hello world');
}
}
window.addEventListener("scroll", sendViewedUpdatesToAnalytics, false);
}