diff --git a/ionic/components/nav/nav-controller.ts b/ionic/components/nav/nav-controller.ts index 5e554f3db4..3c7ca5f6a3 100644 --- a/ionic/components/nav/nav-controller.ts +++ b/ionic/components/nav/nav-controller.ts @@ -1,5 +1,5 @@ import {Compiler, ElementRef, Injector, provide, NgZone, AppViewManager, Renderer} from 'angular2/angular2'; -import {wtfLeave, wtfCreateScope} from 'angular2/angular2'; +import {wtfLeave, wtfCreateScope, WtfScopeFn} from 'angular2/angular2'; import {Ion} from '../ion'; import {IonicApp} from '../app/app'; @@ -100,6 +100,12 @@ import {rafFrames} from '../../util/dom'; */ export class NavController extends Ion { + /** @internal */ + static _tranitionScope: WtfScopeFn = wtfCreateScope('ionic.NavController#_transition()'); + static _loadPageScope: WtfScopeFn = wtfCreateScope('ionic.NavController#loadPage()'); + static _transCompleteScope: WtfScopeFn = wtfCreateScope('ionic.NavController#_transComplete()'); + + constructor( parentnavCtrl: NavController, app: IonicApp, @@ -659,8 +665,6 @@ export class NavController extends Ion { return done(enteringView); } - let wtfScope = wtfCreateScope('ionic.NavController#_transition()')(); - if (!opts.animation) { opts.animation = this.config.get('pageTransition'); } @@ -674,6 +678,8 @@ export class NavController extends Ion { enteringView.loaded(); } + console.time('_transition ' + (enteringView.componentType && enteringView.componentType.name)); + this._stage(enteringView, opts, () => { if (enteringView.shouldDestroy) { // already marked as a view that will be destroyed, don't continue @@ -738,12 +744,14 @@ export class NavController extends Ion { this._zone.run(() => { if (this.keyboard.isOpen()) { this.keyboard.onClose(() => { - this._transComplete(wtfScope); + this._transComplete(); + console.timeEnd('_transition ' + (enteringView.componentType && enteringView.componentType.name)); done(enteringView); }, 32); } else { - this._transComplete(wtfScope); + this._transComplete(); + console.timeEnd('_transition ' + (enteringView.componentType && enteringView.componentType.name)); done(enteringView); } }); @@ -759,11 +767,8 @@ export class NavController extends Ion { * @private */ _stage(viewCtrl, opts, done) { - let wtfScope = wtfCreateScope('ionic.NavController#_stage()')(); - if (viewCtrl.isLoaded() || viewCtrl.shouldDestroy) { // already compiled this view - wtfLeave(wtfScope); return done(); } @@ -773,13 +778,11 @@ export class NavController extends Ion { if (viewCtrl.onReady) { viewCtrl.onReady(() => { viewCtrl.loaded(); - wtfLeave(wtfScope); done(); }); } else { viewCtrl.loaded(); - wtfLeave(wtfScope); done(); } }); @@ -789,10 +792,10 @@ export class NavController extends Ion { * @private */ loadPage(viewCtrl, navbarContainerRef, opts, done) { - let wtfScope = wtfCreateScope('ionic.NavController#loadPage()')(); - // guts of DynamicComponentLoader#loadIntoLocation this._compiler.compileInHost(viewCtrl.componentType).then(hostProtoViewRef => { + let wtfScope = NavController._loadPageScope(); + let providers = this.providers.concat(Injector.resolve([ provide(ViewController, {useValue: viewCtrl}), provide(NavParams, {useValue: viewCtrl.params}) @@ -1099,7 +1102,9 @@ export class NavController extends Ion { /** * @private */ - _transComplete(wtfScope) { + _transComplete() { + let wtfScope = NavController._transCompleteScope(); + this._views.forEach(view => { if (view) { if (view.shouldDestroy) { diff --git a/ionic/components/tabs/tabs.ts b/ionic/components/tabs/tabs.ts index c3ea7b813c..afa6749e94 100644 --- a/ionic/components/tabs/tabs.ts +++ b/ionic/components/tabs/tabs.ts @@ -1,5 +1,4 @@ import {Directive, ElementRef, Optional, Host, NgFor, NgIf, forwardRef, ViewContainerRef} from 'angular2/angular2'; -import {wtfLeave, wtfCreateScope} from 'angular2/angular2'; import {Ion} from '../ion'; import {Attr} from '../app/id'; @@ -177,7 +176,7 @@ export class Tabs extends Ion { return this._touchActive(selectedTab); } - let wtfScope = wtfCreateScope('ionic.Tabs#select()')(); + console.time('Tabs#select ' + selectedTab.id); let opts = { animate: false @@ -193,6 +192,7 @@ export class Tabs extends Ion { selectedPage && selectedPage.willEnter(); selectedTab.load(opts, () => { + this._tabs.forEach(tab => { tab.setSelected(tab === selectedTab); }); @@ -207,7 +207,7 @@ export class Tabs extends Ion { this._onReady = null; } - wtfLeave(wtfScope); + console.time('Tabs#select ' + selectedTab.id); }); } diff --git a/ionic/config/decorators.ts b/ionic/config/decorators.ts index 1f24f42a43..aee58cae5e 100644 --- a/ionic/config/decorators.ts +++ b/ionic/config/decorators.ts @@ -1,5 +1,4 @@ import {Component, bootstrap} from 'angular2/angular2' -import {wtfLeave, wtfCreateScope} from 'angular2/angular2'; import {TapClick} from '../components/tap-click/tap-click'; import {pascalCaseToDashCase} from '../util/util'; @@ -139,10 +138,8 @@ export function App(args={}) { // redefine with added annotations Reflect.defineMetadata('annotations', annotations, cls); - let wtfScope = wtfCreateScope('ionic.bootstrap')(); bootstrap(cls, ionicProviders(args)).then(appRef => { - let tc = appRef.injector.get(TapClick); - wtfLeave(wtfScope); + appRef.injector.get(TapClick); }); return cls;