rename lifecycle events view -> page

This commit is contained in:
Tim Lancina
2015-10-07 14:46:18 -05:00
parent a3da0fa68f
commit 9fc63fe17d
5 changed files with 39 additions and 39 deletions

View File

@@ -52,26 +52,26 @@ export class ContactModal {
console.log('ContactModal constructor')
this.rootView = ModalFirstPage;
}
onViewLoaded() {
console.log('ContactModal onViewLoaded');
onPageLoaded() {
console.log('ContactModal onPageLoaded');
}
onViewWillEnter() {
console.log('ContactModal onViewWillEnter');
onPageWillEnter() {
console.log('ContactModal onPageWillEnter');
}
onViewDidEnter() {
console.log('ContactModal onViewDidEnter');
onPageDidEnter() {
console.log('ContactModal onPageDidEnter');
}
onViewWillLeave() {
console.log('ContactModal onViewWillLeave');
onPageWillLeave() {
console.log('ContactModal onPageWillLeave');
}
onViewDidLeave() {
console.log('ContactModal onViewDidLeave');
onPageDidLeave() {
console.log('ContactModal onPageDidLeave');
}
onViewWillUnload() {
console.log('ContactModal onViewWillUnload');
onPageWillUnload() {
console.log('ContactModal onPageWillUnload');
}
onViewDidUnload() {
console.log('ContactModal onViewDidUnload');
onPageDidUnload() {
console.log('ContactModal onPageDidUnload');
}
}

View File

@@ -97,19 +97,19 @@ import * as util from 'ionic/util';
* template: 'Hello World'
* })
* class HelloWorld {
* onViewLoaded() {
* onPageLoaded() {
* console.log("I'm alive!");
* }
* }
* ```
*
* - `onViewLoaded` - Runs when the page has loaded. This event only happens once per page being created and added to the DOM. If a page leaves but is cached, then this event will not fire again on a subsequent viewing. The `onViewLoaded` event is good place to put your setup code for the page.
* - `onViewWillEnter` - Runs when the page is about to enter and become the active page.
* - `onViewDidEnter` - Runs when the page has fully entered and is now the active page. This event will fire, whether it was the first load or a cached page.
* - `onViewWillLeave` - Runs when the page is about to leave and no longer be the active page.
* - `onViewDidLeave` - Runs when the page has finished leaving and is no longer the active page.
* - `onViewWillUnload` - Runs when the page is about to be destroyed and have its elements removed.
* - `onViewDidUnload` - Runs after the page has been destroyed and its elements have been removed.
* - `onPageLoaded` - Runs when the page has loaded. This event only happens once per page being created and added to the DOM. If a page leaves but is cached, then this event will not fire again on a subsequent viewing. The `onPageLoaded` event is good place to put your setup code for the page.
* - `onPageWillEnter` - Runs when the page is about to enter and become the active page.
* - `onPageDidEnter` - Runs when the page has fully entered and is now the active page. This event will fire, whether it was the first load or a cached page.
* - `onPageWillLeave` - Runs when the page is about to leave and no longer be the active page.
* - `onPageDidLeave` - Runs when the page has finished leaving and is no longer the active page.
* - `onPageWillUnload` - Runs when the page is about to be destroyed and have its elements removed.
* - `onPageDidUnload` - Runs after the page has been destroyed and its elements have been removed.
*
*/
export class NavController extends Ion {

View File

@@ -10,7 +10,7 @@ class View1Cmp {
this.viewCtrl = viewCtrl;
console.log(`View1Cmp, path: ${this.path}`);
}
onViewDidEnter() {
onPageDidEnter() {
this.windowHash = window.location.hash;
}
}
@@ -23,7 +23,7 @@ class View2Cmp {
this.viewCtrl = viewCtrl;
console.log(`View2Cmp, path: ${this.path}`);
}
onViewDidEnter() {
onPageDidEnter() {
this.windowHash = window.location.hash;
}
}
@@ -37,7 +37,7 @@ class View3Cmp {
this.viewCtrl = viewCtrl;
console.log(`View3Cmp, path: ${this.path}, param id: ${this.id}`);
}
onViewDidEnter() {
onPageDidEnter() {
this.windowHash = window.location.hash;
}
}

View File

@@ -217,14 +217,14 @@ export class ViewController {
* recommended method to use when a view becomes active.
*/
loaded() {
this.instance && this.instance.onViewLoaded && this.instance.onViewLoaded();
this.instance && this.instance.onPageLoaded && this.instance.onPageLoaded();
}
/**
* The view is about to enter and become the active view.
*/
willEnter() {
this.instance && this.instance.onViewWillEnter && this.instance.onViewWillEnter();
this.instance && this.instance.onPageWillEnter && this.instance.onPageWillEnter();
}
/**
@@ -236,14 +236,14 @@ export class ViewController {
if (navbarView) {
navbarView.didEnter();
}
this.instance && this.instance.onViewDidEnter && this.instance.onViewDidEnter();
this.instance && this.instance.onPageDidEnter && this.instance.onPageDidEnter();
}
/**
* The view has is about to leave and no longer be the active view.
*/
willLeave() {
this.instance && this.instance.onViewWillLeave && this.instance.onViewWillLeave();
this.instance && this.instance.onPageWillLeave && this.instance.onPageWillLeave();
}
/**
@@ -251,21 +251,21 @@ export class ViewController {
* will fire, whether it is cached or unloaded.
*/
didLeave() {
this.instance && this.instance.onViewDidLeave && this.instance.onViewDidLeave();
this.instance && this.instance.onPageDidLeave && this.instance.onPageDidLeave();
}
/**
* The view is about to be destroyed and have its elements removed.
*/
willUnload() {
this.instance && this.instance.onViewWillUnload && this.instance.onViewWillUnload();
this.instance && this.instance.onPageWillUnload && this.instance.onPageWillUnload();
}
/**
* The view has been destroyed and its elements have been removed.
*/
didUnload() {
this.instance && this.instance.onViewDidUnload && this.instance.onViewDidUnload();
this.instance && this.instance.onPageDidUnload && this.instance.onPageDidUnload();
}
}

View File

@@ -50,8 +50,8 @@ export class OverlayController {
this.close(ref, util.extend(opts, closeOpts));
};
instance.onViewLoaded && instance.onViewLoaded();
instance.onViewWillEnter && instance.onViewWillEnter();
instance.onPageLoaded && instance.onPageLoaded();
instance.onPageWillEnter && instance.onPageWillEnter();
let animation = Animation.create(ref.location.nativeElement, opts.enterAnimation);
animation.before.addClass('show-overlay');
@@ -67,7 +67,7 @@ export class OverlayController {
this.zone.run(() => {
this.app.setEnabled(true);
this.app.setTransitioning(false);
instance.onViewDidEnter && instance.onViewDidEnter();
instance.onPageDidEnter && instance.onPageDidEnter();
resolve();
});
@@ -91,8 +91,8 @@ export class OverlayController {
let promise = new Promise(res => { resolve = res; });
let instance = ref.instance;
instance.onViewWillLeave && instance.onViewWillLeave();
instance.onViewWillUnload && instance.onViewWillUnload();
instance.onPageWillLeave && instance.onPageWillLeave();
instance.onPageWillUnload && instance.onPageWillUnload();
let animation = Animation.create(ref.location.nativeElement, opts.leaveAnimation);
animation.after.removeClass('show-overlay');
@@ -106,8 +106,8 @@ export class OverlayController {
animation.dispose();
this.zone.run(() => {
instance.onViewDidLeave && instance.onViewDidLeave();
instance.onViewDidUnload && instance.onViewDidUnload();
instance.onPageDidLeave && instance.onPageDidLeave();
instance.onPageDidUnload && instance.onPageDidUnload();
this.app.setEnabled(true);
this.app.setTransitioning(false);