diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index e49543bd34..a21cfa7bfc 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -22,7 +22,7 @@ export {APP_INITIALIZER, ApplicationInitStatus} from './application_init'; export * from './zone'; export * from './render'; export * from './linker'; -export {DebugElement, DebugNode, asNativeElements, getDebugNode, Predicate} from './debug/debug_node'; +export {DebugElement, DebugEventListener, DebugNode, asNativeElements, getDebugNode, Predicate} from './debug/debug_node'; export {GetTestability, Testability, TestabilityRegistry, setTestabilityGetter} from './testability/testability'; export * from './change_detection'; export * from './platform_core_providers'; diff --git a/packages/core/src/debug/debug_node.ts b/packages/core/src/debug/debug_node.ts index 7e2a3210ee..12f4c1c245 100644 --- a/packages/core/src/debug/debug_node.ts +++ b/packages/core/src/debug/debug_node.ts @@ -21,7 +21,10 @@ import {getComponentViewByIndex, getNativeByTNode, isComponent, isLContainer} fr import {assertDomNode} from '../util/assert'; import {DebugContext} from '../view/index'; -export class EventListener { +/** + * @publicApi + */ +export class DebugEventListener { constructor(public name: string, public callback: Function) {} } @@ -29,7 +32,7 @@ export class EventListener { * @publicApi */ export interface DebugNode { - readonly listeners: EventListener[]; + readonly listeners: DebugEventListener[]; readonly parent: DebugElement|null; readonly nativeNode: any; readonly injector: Injector; @@ -39,7 +42,7 @@ export interface DebugNode { readonly providerTokens: any[]; } export class DebugNode__PRE_R3__ { - readonly listeners: EventListener[] = []; + readonly listeners: DebugEventListener[] = []; readonly parent: DebugElement|null = null; readonly nativeNode: any; private readonly _debugContext: DebugContext; @@ -219,7 +222,7 @@ class DebugNode__POST_R3__ implements DebugNode { } get context(): any { return getContext(this.nativeNode as Element); } - get listeners(): EventListener[] { + get listeners(): DebugEventListener[] { return getListeners(this.nativeNode as Element).filter(isBrowserEvents); } diff --git a/packages/core/src/view/services.ts b/packages/core/src/view/services.ts index 02302ba35e..8c705f378e 100644 --- a/packages/core/src/view/services.ts +++ b/packages/core/src/view/services.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {DebugElement__PRE_R3__, DebugNode__PRE_R3__, EventListener, getDebugNode, indexDebugNode, removeDebugNodeFromIndex} from '../debug/debug_node'; +import {DebugElement__PRE_R3__, DebugEventListener, DebugNode__PRE_R3__, getDebugNode, indexDebugNode, removeDebugNodeFromIndex} from '../debug/debug_node'; import {Injector} from '../di'; import {InjectableType} from '../di/injectable'; import {getInjectableDef, ɵɵInjectableDef} from '../di/interface/defs'; @@ -827,7 +827,7 @@ export class DebugRenderer2 implements Renderer2 { if (typeof target !== 'string') { const debugEl = getDebugNode(target); if (debugEl) { - debugEl.listeners.push(new EventListener(eventName, callback)); + debugEl.listeners.push(new DebugEventListener(eventName, callback)); } } diff --git a/tools/public_api_guard/core/core.d.ts b/tools/public_api_guard/core/core.d.ts index 74f2fd5e9b..cb31ced994 100644 --- a/tools/public_api_guard/core/core.d.ts +++ b/tools/public_api_guard/core/core.d.ts @@ -224,11 +224,17 @@ export declare const DebugElement: { new (...args: any[]): DebugElement; }; +export declare class DebugEventListener { + callback: Function; + name: string; + constructor(name: string, callback: Function); +} + export interface DebugNode { readonly componentInstance: any; readonly context: any; readonly injector: Injector; - readonly listeners: EventListener[]; + readonly listeners: DebugEventListener[]; readonly nativeNode: any; readonly parent: DebugElement | null; readonly providerTokens: any[];