Destroy old infinite scrollers to keep event bindings from piling up
This commit is contained in:
parent
bc8b6097bc
commit
2abb592833
1 changed files with 10 additions and 1 deletions
|
|
@ -23,6 +23,11 @@
|
|||
};
|
||||
};
|
||||
|
||||
InfiniteScroll.prototype.reInitialize = function(){
|
||||
this.clear();
|
||||
this.initialize();
|
||||
};
|
||||
|
||||
InfiniteScroll.prototype.initialize = function(){
|
||||
$('#main_stream').infinitescroll(this.options(), function() {
|
||||
Diaspora.widgets.publish("stream/scrolled");
|
||||
|
|
@ -30,10 +35,14 @@
|
|||
};
|
||||
|
||||
InfiniteScroll.prototype.start = function() {
|
||||
Diaspora.widgets.subscribe("stream/reloaded", this.initialize, this);
|
||||
Diaspora.widgets.subscribe("stream/reloaded", this.reInitialize, this);
|
||||
this.initialize();
|
||||
};
|
||||
|
||||
InfiniteScroll.prototype.clear = function() {
|
||||
$('#main_stream').infinitescroll('destroy');
|
||||
};
|
||||
|
||||
Diaspora.widgets.add("infinitescroll", InfiniteScroll);
|
||||
})();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue