This commit is contained in:
perry
2015-11-30 14:37:22 -06:00
2 changed files with 25 additions and 20 deletions

View File

@ -1,4 +1,5 @@
import {Compiler, ElementRef, Injector, provide, NgZone, DynamicComponentLoader, AppViewManager, Renderer} from 'angular2/angular2'; import {Compiler, ElementRef, Injector, provide, NgZone, DynamicComponentLoader, AppViewManager, Renderer} from 'angular2/angular2';
import {wtfLeave, wtfCreateScope} from 'angular2/angular2';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {IonicApp} from '../app/app'; import {IonicApp} from '../app/app';
@ -581,6 +582,8 @@ export class NavController extends Ion {
return done(enteringView); return done(enteringView);
} }
let wtfScope = wtfCreateScope('NavController#_transition()')();
if (!opts.animation) { if (!opts.animation) {
opts.animation = this.config.get('pageTransition'); opts.animation = this.config.get('pageTransition');
} }
@ -658,12 +661,12 @@ export class NavController extends Ion {
this._zone.run(() => { this._zone.run(() => {
if (this.keyboard.isOpen()) { if (this.keyboard.isOpen()) {
this.keyboard.onClose(() => { this.keyboard.onClose(() => {
this._transComplete(); this._transComplete(wtfScope);
done(enteringView); done(enteringView);
}, 32); }, 32);
} else { } else {
this._transComplete(); this._transComplete(wtfScope);
done(enteringView); done(enteringView);
} }
}); });
@ -679,8 +682,11 @@ export class NavController extends Ion {
* @private * @private
*/ */
_stage(viewCtrl, opts, done) { _stage(viewCtrl, opts, done) {
let wtfScope = wtfCreateScope('NavController#_stage()')();
if (viewCtrl.isLoaded() || viewCtrl.shouldDestroy) { if (viewCtrl.isLoaded() || viewCtrl.shouldDestroy) {
// already compiled this view // already compiled this view
wtfLeave(wtfScope);
return done(); return done();
} }
@ -690,25 +696,30 @@ export class NavController extends Ion {
if (viewCtrl.onReady) { if (viewCtrl.onReady) {
viewCtrl.onReady(() => { viewCtrl.onReady(() => {
viewCtrl.loaded(); viewCtrl.loaded();
wtfLeave(wtfScope);
done(); done();
}); });
} else { } else {
viewCtrl.loaded(); viewCtrl.loaded();
wtfLeave(wtfScope);
done(); done();
} }
}); });
} }
/**
* @private
*/
loadPage(viewCtrl, navbarContainerRef, opts, done) { loadPage(viewCtrl, navbarContainerRef, opts, done) {
let wtfScope = wtfCreateScope('NavController#loadPage()')();
let providers = this.providers.concat(Injector.resolve([ let providers = this.providers.concat(Injector.resolve([
provide(ViewController, {useValue: viewCtrl}), provide(ViewController, {useValue: viewCtrl}),
provide(NavParams, {useValue: viewCtrl.params}) provide(NavParams, {useValue: viewCtrl.params})
])); ]));
console.time('loadPage ' + viewCtrl.componentType.name + ': loadIntoLocation');
this._loader.loadIntoLocation(viewCtrl.componentType, this.elementRef, 'contents', providers).then(componentRef => { this._loader.loadIntoLocation(viewCtrl.componentType, this.elementRef, 'contents', providers).then(componentRef => {
console.timeEnd('loadPage ' + viewCtrl.componentType.name + ': loadIntoLocation');
viewCtrl.addDestroy(() => { viewCtrl.addDestroy(() => {
componentRef.dispose(); componentRef.dispose();
@ -727,10 +738,7 @@ export class NavController extends Ion {
let navbarTemplateRef = viewCtrl.getNavbarTemplateRef(); let navbarTemplateRef = viewCtrl.getNavbarTemplateRef();
if (navbarContainerRef && navbarTemplateRef) { if (navbarContainerRef && navbarTemplateRef) {
console.time('loadPage ' + viewCtrl.componentType.name + ': create navbar');
let navbarView = navbarContainerRef.createEmbeddedView(navbarTemplateRef); let navbarView = navbarContainerRef.createEmbeddedView(navbarTemplateRef);
console.timeEnd('loadPage ' + viewCtrl.componentType.name + ': create navbar');
viewCtrl.addDestroy(() => { viewCtrl.addDestroy(() => {
let index = navbarContainerRef.indexOf(navbarView); let index = navbarContainerRef.indexOf(navbarView);
@ -750,6 +758,8 @@ export class NavController extends Ion {
}); });
} }
wtfLeave(wtfScope);
done(viewCtrl); done(viewCtrl);
}); });
} }
@ -806,7 +816,6 @@ export class NavController extends Ion {
/** /**
* @private * @private
* TODO
*/ */
swipeBackStart() { swipeBackStart() {
return; return;
@ -857,8 +866,6 @@ export class NavController extends Ion {
/** /**
* @private * @private
* TODO
* @param {TODO} progress TODO
*/ */
swipeBackProgress(value) { swipeBackProgress(value) {
return; return;
@ -874,8 +881,6 @@ export class NavController extends Ion {
/** /**
* @private * @private
* @param {TODO} completeSwipeBack Should the swipe back complete or not.
* @param {number} rate How fast it closes
*/ */
swipeBackEnd(completeSwipeBack, rate) { swipeBackEnd(completeSwipeBack, rate) {
return; return;
@ -938,7 +943,6 @@ export class NavController extends Ion {
/** /**
* @private * @private
* TODO
*/ */
_sbComplete() { _sbComplete() {
return; return;
@ -1007,7 +1011,7 @@ export class NavController extends Ion {
/** /**
* @private * @private
*/ */
_transComplete() { _transComplete(wtfScope) {
this._views.forEach(view => { this._views.forEach(view => {
if (view) { if (view) {
if (view.shouldDestroy) { if (view.shouldDestroy) {
@ -1027,6 +1031,8 @@ export class NavController extends Ion {
this._sbComplete(); this._sbComplete();
this._cleanup(); this._cleanup();
wtfScope && wtfLeave(wtfScope);
} }
/** /**
@ -1061,8 +1067,6 @@ export class NavController extends Ion {
/** /**
* @private * @private
* @param {TODO} nbContainer TODO
* @returns {TODO} TODO
*/ */
navbarViewContainer(nbContainer) { navbarViewContainer(nbContainer) {
if (nbContainer) { if (nbContainer) {

View File

@ -1,4 +1,5 @@
import {Directive, ElementRef, Optional, Host, NgFor, NgIf, forwardRef, ViewContainerRef} from 'angular2/angular2'; import {Directive, ElementRef, Optional, Host, NgFor, NgIf, forwardRef, ViewContainerRef} from 'angular2/angular2';
import {wtfLeave, wtfCreateScope} from 'angular2/angular2';
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Attr} from '../app/id'; import {Attr} from '../app/id';
@ -169,8 +170,6 @@ export class Tabs extends Ion {
return Promise.reject(); return Promise.reject();
} }
console.time('select tab ' + selectedTab.id);
let deselectedTab = this.getSelected(); let deselectedTab = this.getSelected();
if (selectedTab === deselectedTab) { if (selectedTab === deselectedTab) {
@ -178,6 +177,8 @@ export class Tabs extends Ion {
return this._touchActive(selectedTab); return this._touchActive(selectedTab);
} }
let wtfScope = wtfCreateScope('Tabs#select()')();
let opts = { let opts = {
animate: false animate: false
}; };
@ -205,8 +206,8 @@ export class Tabs extends Ion {
this._onReady(); this._onReady();
this._onReady = null; this._onReady = null;
} }
console.timeEnd('select tab ' + selectedTab.id); wtfLeave(wtfScope);
}); });
} }