Skip to content

Commit

Permalink
Run service teardown code in willDestroy()
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeAstapov authored Mar 25, 2021
1 parent 9d494b5 commit a32f41c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions addon/services/router-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ class RouterScroll extends Service {
addListener(this.router, 'routeDidChange', this._routeDidChange);
}

destroy() {
reset();

willDestroy() {
removeListener(this.router, 'routeWillChange', this._routeWillChange);
removeListener(this.router, 'routeDidChange', this._routeDidChange);

Expand All @@ -105,7 +103,7 @@ class RouterScroll extends Service {
window.cancelAnimationFrame(callbackRequestId);
}

super.destroy(...arguments);
super.willDestroy(...arguments);
}

/**
Expand Down

0 comments on commit a32f41c

Please sign in to comment.