refactor(platform-browser): Remove setGlobalVar from DOM adapter
This commit is contained in:

committed by
Alex Rickabaugh

parent
d4e196035c
commit
bb2fc6b8da
@ -363,7 +363,6 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||
}
|
||||
getComputedStyle(element: any): any { return getComputedStyle(element); }
|
||||
// TODO(tbosch): move this into a separate environment class once we have it
|
||||
setGlobalVar(path: string, value: any) { setValueOnPath(global, path, value); }
|
||||
supportsWebAnimation(): boolean {
|
||||
return typeof(<any>Element).prototype['animate'] === 'function';
|
||||
}
|
||||
@ -419,20 +418,3 @@ export function parseCookieValue(cookieStr: string, name: string): string|null {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function setValueOnPath(global: any, path: string, value: any) {
|
||||
const parts = path.split('.');
|
||||
let obj: any = global;
|
||||
while (parts.length > 1) {
|
||||
const name = parts.shift() !;
|
||||
if (obj.hasOwnProperty(name) && obj[name] != null) {
|
||||
obj = obj[name];
|
||||
} else {
|
||||
obj = obj[name] = {};
|
||||
}
|
||||
}
|
||||
if (obj === undefined || obj === null) {
|
||||
obj = {};
|
||||
}
|
||||
obj[parts.shift() !] = value;
|
||||
}
|
||||
|
@ -7,11 +7,10 @@
|
||||
*/
|
||||
|
||||
import {ComponentRef} from '@angular/core';
|
||||
import {getDOM} from '../../dom/dom_adapter';
|
||||
|
||||
import {exportNgVar} from '../../dom/util';
|
||||
import {AngularProfiler} from './common_tools';
|
||||
|
||||
const PROFILER_GLOBAL_NAME = 'ng.profiler';
|
||||
const PROFILER_GLOBAL_NAME = 'profiler';
|
||||
|
||||
/**
|
||||
* Enabled Angular debug tools that are accessible via your browser's
|
||||
@ -27,7 +26,7 @@ const PROFILER_GLOBAL_NAME = 'ng.profiler';
|
||||
* @experimental All debugging apis are currently experimental.
|
||||
*/
|
||||
export function enableDebugTools<T>(ref: ComponentRef<T>): ComponentRef<T> {
|
||||
getDOM().setGlobalVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
|
||||
exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
|
||||
return ref;
|
||||
}
|
||||
|
||||
@ -37,5 +36,5 @@ export function enableDebugTools<T>(ref: ComponentRef<T>): ComponentRef<T> {
|
||||
* @experimental All debugging apis are currently experimental.
|
||||
*/
|
||||
export function disableDebugTools(): void {
|
||||
getDOM().setGlobalVar(PROFILER_GLOBAL_NAME, null);
|
||||
exportNgVar(PROFILER_GLOBAL_NAME, null);
|
||||
}
|
||||
|
Reference in New Issue
Block a user