refactor(platform-browser): remove deprecated `NgProbeToken` (#18760)

BREAKING CHANGE: `NgProbeToken` has been removed from `@angular/platform-browser` as it was deprecated since v4. Import it from `@angular/core` instead.

PR Close #18760
This commit is contained in:
Olivier Combe 2017-08-17 15:52:24 +02:00 committed by Miško Hevery
parent 8f413268cf
commit d7f42bfbe6
3 changed files with 3 additions and 21 deletions

View File

@ -26,22 +26,13 @@ export function inspectNativeElement(element: any): core.DebugNode|null {
return core.getDebugNode(element); return core.getDebugNode(element);
} }
/** export function _createNgProbe(coreTokens: core.NgProbeToken[]): any {
* Deprecated. Use the one from '@angular/core'.
* @deprecated
*/
export class NgProbeToken {
constructor(public name: string, public token: any) {}
}
export function _createNgProbe(extraTokens: NgProbeToken[], coreTokens: core.NgProbeToken[]): any {
const tokens = (extraTokens || []).concat(coreTokens || []);
exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement); exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
exportNgVar(CORE_TOKENS_GLOBAL_NAME, {...CORE_TOKENS, ..._ngProbeTokensToMap(tokens || [])}); exportNgVar(CORE_TOKENS_GLOBAL_NAME, {...CORE_TOKENS, ..._ngProbeTokensToMap(coreTokens || [])});
return () => inspectNativeElement; return () => inspectNativeElement;
} }
function _ngProbeTokensToMap(tokens: NgProbeToken[]): {[name: string]: any} { function _ngProbeTokensToMap(tokens: core.NgProbeToken[]): {[name: string]: any} {
return tokens.reduce((prev: any, t: any) => (prev[t.name] = t.token, prev), {}); return tokens.reduce((prev: any, t: any) => (prev[t.name] = t.token, prev), {});
} }
@ -53,7 +44,6 @@ export const ELEMENT_PROBE_PROVIDERS: core.Provider[] = [
provide: core.APP_INITIALIZER, provide: core.APP_INITIALIZER,
useFactory: _createNgProbe, useFactory: _createNgProbe,
deps: [ deps: [
[NgProbeToken, new core.Optional()],
[core.NgProbeToken, new core.Optional()], [core.NgProbeToken, new core.Optional()],
], ],
multi: true, multi: true,

View File

@ -11,7 +11,6 @@ export {Meta, MetaDefinition} from './browser/meta';
export {Title} from './browser/title'; export {Title} from './browser/title';
export {disableDebugTools, enableDebugTools} from './browser/tools/tools'; export {disableDebugTools, enableDebugTools} from './browser/tools/tools';
export {By} from './dom/debug/by'; export {By} from './dom/debug/by';
export {NgProbeToken} from './dom/debug/ng_probe';
export {DOCUMENT} from './dom/dom_tokens'; export {DOCUMENT} from './dom/dom_tokens';
export {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager'; export {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager';
export {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from './dom/events/hammer_gestures'; export {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from './dom/events/hammer_gestures';

View File

@ -82,13 +82,6 @@ export declare type MetaDefinition = {
[prop: string]: string; [prop: string]: string;
}; };
/** @deprecated */
export declare class NgProbeToken {
name: string;
token: any;
constructor(name: string, token: any);
}
/** @stable */ /** @stable */
export declare const platformBrowser: (extraProviders?: StaticProvider[]) => PlatformRef; export declare const platformBrowser: (extraProviders?: StaticProvider[]) => PlatformRef;