feat: add interface definitions which zone extends EventTarget (#35304)
Close #35173 PR Close #35304
This commit is contained in:

committed by
Miško Hevery

parent
df816c9c80
commit
4acb676f2e
38
packages/zone.js/lib/zone.api.extensions.ts
Normal file
38
packages/zone.js/lib/zone.api.extensions.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Additional `EventTarget` methods added by `Zone.js`.
|
||||
*
|
||||
* 1. removeAllListeners, remove all event listeners of the given event name.
|
||||
* 2. eventListeners, get all event listeners of the given event name.
|
||||
*/
|
||||
interface EventTarget {
|
||||
/**
|
||||
*
|
||||
* Remove all event listeners by name for this event target.
|
||||
*
|
||||
* If the `eventName` is provided, will remove event listeners of that name.
|
||||
* If the `eventName` is not provided, will remove all event listeners associated with
|
||||
* `EventTarget`.
|
||||
*
|
||||
* @param eventName the name of the event, such as `click`. This parameter is optional.
|
||||
*/
|
||||
removeAllListeners(eventName?: string): void;
|
||||
/**
|
||||
*
|
||||
* Retrieve all event listeners by name.
|
||||
*
|
||||
* If the `eventName` is provided, will return an array of event handlers or event listener
|
||||
* objects of the given event.
|
||||
* If the `eventName` is not provided, will return all listeners.
|
||||
*
|
||||
* @param eventName the name of the event, such as click. This parameter is optional.
|
||||
*/
|
||||
eventListeners(eventName?: string): EventListenerOrEventListenerObject[];
|
||||
}
|
Reference in New Issue
Block a user