refactor: remove facade/browser (#14837)

This commit is contained in:
Miško Hevery
2017-03-01 10:54:24 -08:00
committed by Chuck Jazdzewski
parent 928c5657c8
commit 4fe0b90948
2 changed files with 7 additions and 32 deletions

View File

@ -9,9 +9,9 @@
import {ApplicationRef, ComponentRef} from '@angular/core';
import {getDOM} from '../../dom/dom_adapter';
import {window} from '../../facade/browser';
import {NumberWrapper, isPresent} from '../../facade/lang';
import {isPresent} from '../../facade/lang';
const win = typeof window !== 'undefined' && window || <any>{};
export class ChangeDetectionPerfRecord {
constructor(public msPerTick: number, public numTicks: number) {}
@ -47,9 +47,9 @@ export class AngularProfiler {
const record = config && config['record'];
const profileName = 'Change Detection';
// Profiler is not available in Android browsers, nor in IE 9 without dev tools opened
const isProfilerAvailable = isPresent(window.console.profile);
const isProfilerAvailable = isPresent(win.console.profile);
if (record && isProfilerAvailable) {
window.console.profile(profileName);
win.console.profile(profileName);
}
const start = getDOM().performanceNow();
let numTicks = 0;
@ -63,11 +63,11 @@ export class AngularProfiler {
// while in fact there is:
//
// https://developer.mozilla.org/en-US/docs/Web/API/Console/profileEnd
(<any>window.console.profileEnd)(profileName);
(<any>win.console.profileEnd)(profileName);
}
const msPerTick = (end - start) / numTicks;
window.console.log(`ran ${numTicks} change detection cycles`);
window.console.log(`${msPerTick.toFixed(2)} ms per check`);
win.console.log(`ran ${numTicks} change detection cycles`);
win.console.log(`${msPerTick.toFixed(2)} ms per check`);
return new ChangeDetectionPerfRecord(msPerTick, numTicks);
}