remove willCache didCache

This commit is contained in:
Adam Bradley
2015-06-29 16:44:27 -05:00
parent 6f3dd4eb7d
commit 42a641a03e
7 changed files with 4 additions and 53 deletions

View File

@ -45,8 +45,10 @@ export class IonicApp {
return this._zone; return this._zone;
} }
stateChange() { stateChange(activeView) {
console.log('stage change'); console.log('stage change', activeView);
} }

View File

@ -69,14 +69,6 @@ export class FirstPage {
console.log('viewDidLeave first page'); console.log('viewDidLeave first page');
} }
viewWillCache() {
console.log('viewWillCache first page');
}
viewDidCache() {
console.log('viewDidCache first page');
}
viewWillUnload() { viewWillUnload() {
console.log('viewWillUnload first page'); console.log('viewWillUnload first page');
} }

View File

@ -68,14 +68,6 @@ export class SecondPage {
console.log('viewDidLeave second page'); console.log('viewDidLeave second page');
} }
viewWillCache() {
console.log('viewWillCache second page');
}
viewDidCache() {
console.log('viewDidCache second page');
}
viewWillUnload() { viewWillUnload() {
console.log('viewWillUnload second page'); console.log('viewWillUnload second page');
} }

View File

@ -49,14 +49,6 @@ export class ThirdPage {
console.log('viewDidLeave third page'); console.log('viewDidLeave third page');
} }
viewWillCache() {
console.log('viewWillCache third page');
}
viewDidCache() {
console.log('viewDidCache third page');
}
viewWillUnload() { viewWillUnload() {
console.log('viewWillUnload third page'); console.log('viewWillUnload third page');
} }

View File

@ -110,7 +110,6 @@ export class Tabs extends ViewController {
let leavingItem = this.getActive() || new ViewItem(); let leavingItem = this.getActive() || new ViewItem();
leavingItem.shouldDestroy = false; leavingItem.shouldDestroy = false;
leavingItem.shouldCache = true; leavingItem.shouldCache = true;
leavingItem.willCache();
this.transition(enteringItem, leavingItem, opts, () => { this.transition(enteringItem, leavingItem, opts, () => {
resolve(); resolve();

View File

@ -4,7 +4,6 @@ import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_compone
import {AppViewManager} from 'angular2/src/core/compiler/view_manager'; import {AppViewManager} from 'angular2/src/core/compiler/view_manager';
import {Injector, bind} from 'angular2/di'; import {Injector, bind} from 'angular2/di';
import {IonicApp} from '../app/app';
import {IonicRouter} from '../../routing/router'; import {IonicRouter} from '../../routing/router';
import {ViewItem} from './view-item'; import {ViewItem} from './view-item';
import {NavController} from '../nav/nav-controller'; import {NavController} from '../nav/nav-controller';
@ -27,7 +26,6 @@ export class ViewController {
this.loader = injector.get(DynamicComponentLoader); this.loader = injector.get(DynamicComponentLoader);
this.viewMngr = injector.get(AppViewManager); this.viewMngr = injector.get(AppViewManager);
this.router = injector.get(IonicRouter); this.router = injector.get(IonicRouter);
this.app = injector.get(IonicApp);
this.router.addViewController(this); this.router.addViewController(this);
@ -67,7 +65,6 @@ export class ViewController {
let leavingItem = this.getActive() || new ViewItem(); let leavingItem = this.getActive() || new ViewItem();
leavingItem.shouldDestroy = false; leavingItem.shouldDestroy = false;
leavingItem.shouldCache = true; leavingItem.shouldCache = true;
leavingItem.willCache();
// create a new ViewItem // create a new ViewItem
let enteringItem = new ViewItem(this, ComponentType, params); let enteringItem = new ViewItem(this, ComponentType, params);
@ -303,14 +300,11 @@ export class ViewController {
item.destroy(); item.destroy();
} else if (item.state === CACHED_STATE && item.shouldCache) { } else if (item.state === CACHED_STATE && item.shouldCache) {
item.cache();
item.shouldCache = false; item.shouldCache = false;
} }
} }
}); });
this.app.stateChange();
// allow clicks again // allow clicks again
ClickBlock(false); ClickBlock(false);
} }

View File

@ -159,10 +159,6 @@ export class ViewItem {
this.instance._viewWillEnter = new EventEmitter('viewWillEnter'); this.instance._viewWillEnter = new EventEmitter('viewWillEnter');
} }
cache() {
this.didCache();
}
destroy() { destroy() {
for (let i = 0; i < this.disposals.length; i++) { for (let i = 0; i < this.disposals.length; i++) {
this.disposals[i](); this.disposals[i]();
@ -254,7 +250,6 @@ export class ViewItem {
*/ */
willEnter() { willEnter() {
this.instance && this.instance.viewWillEnter && this.instance.viewWillEnter(); this.instance && this.instance.viewWillEnter && this.instance.viewWillEnter();
this.instance && this.instance._viewWillEnter.next();
} }
/* /*
@ -268,7 +263,6 @@ export class ViewItem {
navbarView.didEnter(); navbarView.didEnter();
} }
this.instance && this.instance.viewDidEnter && this.instance.viewDidEnter(); this.instance && this.instance.viewDidEnter && this.instance.viewDidEnter();
this.instance && this.instance._viewDidEnter.next();
} }
/* /*
@ -286,20 +280,6 @@ export class ViewItem {
this.instance && this.instance.viewDidLeave && this.instance.viewDidLeave(); this.instance && this.instance.viewDidLeave && this.instance.viewDidLeave();
} }
/*
The view is about to become cached.
*/
willCache() {
this.instance && this.instance.viewWillCache && this.instance.viewWillCache();
}
/*
The view is now cached.
*/
didCache() {
this.instance && this.instance.viewDidCache && this.instance.viewDidCache();
}
/* /*
The view is about to be destroyed and have its elements removed. The view is about to be destroyed and have its elements removed.
*/ */