Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
fix(navigation): fixed nodes leak when opening and closing modals
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisCamus authored and liamdebeasi committed Mar 12, 2019
1 parent ee3d5f5 commit b0426a3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/navigation/view-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class ViewController {
_state: number = STATE_NEW;
_cssClass: string;
_ts: number;
_bindHandler: any;

/**
* Observable to be subscribed to when the current component will become active
Expand Down Expand Up @@ -113,7 +114,8 @@ export class ViewController {

this._cssClass = rootCssClass;
this._ts = Date.now();
window.addEventListener('orientationchange', this.handleOrientationChange.bind(this));
this._bindHandler = this.handleOrientationChange.bind(this);
window.addEventListener('orientationchange', this._bindHandler);
}

handleOrientationChange() {
Expand Down Expand Up @@ -542,7 +544,7 @@ export class ViewController {
renderer.setElementAttribute(cmpEle, 'style', null);
}

window.removeEventListener('orientationchange', this.handleOrientationChange.bind(this));
window.removeEventListener('orientationchange', this._bindHandler);
// completely destroy this component. boom.
this._cmp.destroy();
}
Expand Down

0 comments on commit b0426a3

Please sign in to comment.