chore(wtf): figure out wtf

This commit is contained in:
Adam Bradley
2015-11-30 21:52:44 -06:00
parent abf482f662
commit 85d6d6f89e
3 changed files with 22 additions and 20 deletions

View File

@@ -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) {

View File

@@ -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);
});
}

View File

@@ -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;