events: {
    off(node: HTMLElement | Document, eventName: string, callback: EventListenerCallbackType, useCapture?: boolean): void;
    on(node: HTMLElement | Document, eventName: string, callback: EventListenerCallbackType, useCapture?: boolean): {
        off: (() => void);
    };
} = ...

Type declaration

  • off:function
    • 取消事件监听器

      Parameters

      • node: HTMLElement | Document

        HTML 元素

      • eventName: string

        事件名

      • callback: EventListenerCallbackType

        事件监听器

      • useCapture: boolean = false

        是否开启事件捕获

      Returns void

  • on:function
    • 绑定事件监听器

      Parameters

      • node: HTMLElement | Document

        HTML 元素

      • eventName: string

        事件名

      • callback: EventListenerCallbackType

        监听器函数

      • useCapture: boolean = false

        是否开启事件捕获

      Returns {
          off: (() => void);
      }

      off 用于快速取消事件监听

      • off: (() => void)
          • (): void
          • Returns void