chore(): add time/timeEnd console logs

This commit is contained in:
Adam Bradley
2015-11-04 14:45:10 -06:00
parent f887f7c7be
commit 9075f7b154
3 changed files with 30 additions and 8 deletions

View File

@@ -456,8 +456,11 @@ export class NavController extends Ion {
enteringView.shouldDestroy = false;
enteringView.shouldCache = false;
enteringView.willEnter();
leavingView.willLeave();
if (!opts.preload) {
enteringView.willEnter();
leavingView.willLeave();
}
// set that the new view pushed on the stack is staged to be entering/leaving
// staged state is important for the transition to find the correct view
@@ -490,8 +493,10 @@ export class NavController extends Ion {
// dispose any views that shouldn't stay around
transAnimation.dispose();
enteringView.didEnter();
leavingView.didLeave();
if (!opts.preload) {
enteringView.didEnter();
leavingView.didLeave();
}
// all done!
this._zone.run(() => {
@@ -536,7 +541,9 @@ export class NavController extends Ion {
provide(NavParams, {useValue: viewCtrl.params})
]));
console.time('loadPage ' + viewCtrl.componentType.name + ': loadIntoLocation');
this._loader.loadIntoLocation(viewCtrl.componentType, this.elementRef, 'contents', providers).then(componentRef => {
console.timeEnd('loadPage ' + viewCtrl.componentType.name + ': loadIntoLocation');
viewCtrl.addDestroy(() => {
componentRef.dispose();
@@ -555,7 +562,10 @@ export class NavController extends Ion {
let navbarTemplateRef = viewCtrl.getNavbarTemplateRef();
if (navbarContainerRef && navbarTemplateRef) {
console.time('loadPage ' + viewCtrl.componentType.name + ': createEmbeddedView');
let navbarView = navbarContainerRef.createEmbeddedView(navbarTemplateRef);
console.timeEnd('loadPage ' + viewCtrl.componentType.name + ': createEmbeddedView');
viewCtrl.addDestroy(() => {
let index = navbarContainerRef.indexOf(navbarView);

View File

@@ -118,8 +118,7 @@ export function App(args={}) {
// get current annotations
let annotations = Reflect.getMetadata('annotations', cls) || [];
// default to select <ion-app>
args.selector = args.selector || 'ion-app';
args.selector = 'ion-app';
// auto add Ionic directives
args.directives = args.directives ? args.directives.concat(IONIC_DIRECTIVES) : IONIC_DIRECTIVES;
@@ -135,7 +134,10 @@ export function App(args={}) {
// redefine with added annotations
Reflect.defineMetadata('annotations', annotations, cls);
bootstrap(cls, ionicProviders(args.config));
console.time('bootstrap');
bootstrap(cls, ionicProviders(args.config)).then(() => {
console.timeEnd('bootstrap');
});
return cls;
}

View File

@@ -7,6 +7,14 @@
<link href="../../../css/ionic.css" rel="stylesheet">
<script>
if (!console.time) {
console.time = console.log;
}
if (!console.timeEnd) {
console.timeEnd = console.log;
}
console.time('script init');
if (location.href.indexOf('snapshot=true') > -1) {
document.documentElement.classList.add('snapshot');
} else {
@@ -76,7 +84,9 @@
"rx": "rx"
}
})
System.import("index").then(function(m) {}, console.error.bind(console));;
System.import("index").then(function(m) {}, console.error.bind(console));
console.timeEnd('script init');
</script>
</body>