mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 22:43:43 +08:00
FIX: prevents screen-track from leaking object (#7734)
This commit is contained in:
parent
240b61e844
commit
2dce650b72
|
@ -26,7 +26,8 @@ export default class {
|
|||
// Create an interval timer if we don't have one.
|
||||
if (!this._interval) {
|
||||
this._interval = setInterval(() => this.tick(), 1000);
|
||||
$(window).on("scroll.screentrack", this.scrolled.bind(this));
|
||||
this._boundScrolled = Ember.run.bind(this, this.scrolled);
|
||||
$(window).on("scroll.screentrack", this._boundScrolled);
|
||||
}
|
||||
|
||||
this._topicId = topicId;
|
||||
|
@ -39,7 +40,10 @@ export default class {
|
|||
return;
|
||||
}
|
||||
|
||||
$(window).off("scroll.screentrack", this.scrolled);
|
||||
if (this._boundScrolled) {
|
||||
$(window).off("scroll.screentrack", this._boundScrolled);
|
||||
}
|
||||
|
||||
this.tick();
|
||||
this.flush();
|
||||
this.reset();
|
||||
|
|
Loading…
Reference in New Issue
Block a user