Skip to content

Commit

Permalink
Unobserve intersection observer
Browse files Browse the repository at this point in the history
  • Loading branch information
latata committed Feb 9, 2018
1 parent 8306c39 commit 8d29e42
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions addon/mixins/in-viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ export default Mixin.create({
willDestroyElement() {
this._super(...arguments);
this._unbindListeners();
if (this.intersectionObserver) {
this.intersectionObserver.unobserve(this.element);
}
},

_buildOptions(defaultOptions = {}) {
Expand Down Expand Up @@ -257,6 +254,13 @@ export default Mixin.create({
$(context).off(`${event}.${elementId}`);
});

this._unobserveIntersectionObserver();
this._unbindScrollDirectionListener();
}

_unobserveIntersectionObserver() {
if (this.intersectionObserver) {
this.intersectionObserver.unobserve(this.element);
}
}
});

0 comments on commit 8d29e42

Please sign in to comment.