填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

EventManager

通过浏览器插件为 Angular 提供事件管理的可注入服务。

An injectable service that provides event management for Angular through a browser plug-in.

      
      class EventManager {
  constructor(plugins: EventManagerPlugin[], _zone: NgZone)
  addEventListener(element: HTMLElement, eventName: string, handler: Function): Function
  addGlobalEventListener(target: string, eventName: string, handler: Function): Function
  getZone(): NgZone
}
    

构造函数

初始化事件管理器服务的实例。

Initializes an instance of the event-manager service.

      
      constructor(plugins: EventManagerPlugin[], _zone: NgZone)
    
参数
plugins EventManagerPlugin[]
_zone NgZone

方法

注册特定元素和事件的处理器。

Registers a handler for a specific element and event.

      
      addEventListener(element: HTMLElement, eventName: string, handler: Function): Function
    
参数
element HTMLElement

要接收事件通知的 HTML 元素。

The HTML element to receive event notifications.

eventName string

要监听的事件的名称。

The name of the event to listen for.

handler Function

通知发生时调用的函数。接收事件对象作为参数。

A function to call when the notification occurs. Receives the event object as an argument.

返回值

可用于删除处理器的回调函数。

Function: A callback function that can be used to remove the handler.

在目标视图中注册全局事件处理器。

Registers a global handler for an event in a target view.

      
      addGlobalEventListener(target: string, eventName: string, handler: Function): Function
    

Deprecated No longer being used in Ivy code. To be removed in version 14.

参数
target string

全局事件通知的目标。 "window"、"document"、"body" 之一。

A target for global event notifications. One of "window", "document", or "body".

eventName string

要监听的事件的名称。

The name of the event to listen for.

handler Function

事件发生时要调用的函数。接收事件对象作为参数。

A function to call when the notification occurs. Receives the event object as an argument.

返回值

可用于删除处理器的回调函数。

Function: A callback function that can be used to remove the handler.

检索在其中注册了事件侦听器的编译 Zone。

Retrieves the compilation zone in which event listeners are registered.

      
      getZone(): NgZone
    
参数

没有参数。

返回值

NgZone