fix(NavController): fire onPageWillUnload/DidUnload

Fixes #5507
This commit is contained in:
Adam Bradley
2016-02-18 11:05:45 -06:00
parent 7e3eb23345
commit 8f0b88b7e4
3 changed files with 45 additions and 21 deletions

View File

@@ -183,23 +183,6 @@ export class ViewController {
return (this.index === 0);
}
/**
* @private
*/
addDestroy(destroyFn: Function) {
this._destroys.push(destroyFn);
}
/**
* @private
*/
destroy() {
for (var i = 0; i < this._destroys.length; i++) {
this._destroys[i]();
}
this._destroys = [];
}
/**
* @private
*/
@@ -489,10 +472,21 @@ export class ViewController {
/**
* @private
* The view has been destroyed and its elements have been removed.
*/
didUnload() {
addDestroy(destroyFn: Function) {
this._destroys.push(destroyFn);
}
/**
* @private
*/
destroy() {
ctrlFn(this, 'onPageDidUnload');
for (var i = 0; i < this._destroys.length; i++) {
this._destroys[i]();
}
this._destroys = [];
}
}