神岛 API 文档 - ArenaPro版
    Preparing search index...

    Class EventEmitter<EventMap>

    事件处理模块

    Event handling module

    Type Parameters

    • EventMap extends Record<string, any>
    Index

    Methods

    • Type Parameters

      • K extends string | number | symbol

      Parameters

      Returns void

      与 on 是同一个方法,只是方法名不同。

      The same method as on, just with a different name.

      监听的事件类型,是个字符串。

      The type of event to listen for, which is a string.

      监听到事件类型后的处理函数。

      The handler function after listening to the event type.

    • Type Parameters

      • K extends string | number | symbol

      Parameters

      Returns void

      触发指定的事件

      Triggers the specified event

    • Type Parameters

      • K extends string | number | symbol

      Parameters

      Returns void

      与 remove 是同一个方法,只是方法名不同。

      The same method as remove, just with a different name.

      要移除的事件类型。

      The type of event to remove.

      要移除的事件处理函数。

      The event handler function to remove.

    • Type Parameters

      • K extends string | number | symbol

      Parameters

      Returns void

      监听指定的事件。

      Listens to the specified event.

      监听的事件类型,是个字符串。

      The type of event to listen for, which is a string.

      监听到事件类型后的处理函数。

      The handler function after listening to the event type.

    • Type Parameters

      • K extends string | number | symbol

      Parameters

      Returns void

      与 on 的区别是仅触发一次。

      The difference from on is that it only triggers once.

      监听的事件类型,是个字符串。

      The type of event to listen for, which is a string.

      监听到事件类型后的处理函数。

      The handler function after listening to the event type.

    • Type Parameters

      • K extends string | number | symbol

      Parameters

      Returns void

      移除找到的第一个 listener。

      Removes the first listener found.

      要移除的事件类型。

      The type of event to remove.

      要移除的事件处理函数。

      The event handler function to remove.

    • Type Parameters

      • K extends string | number | symbol

      Parameters

      • Optionaltype: K
      • Optionallistener: (event: EventMap[K]) => void

      Returns void

      移除找到的所有 listener,不传则移除事件下所有。

      Removes all found listeners, or all listeners for the event if none are passed.

      要移除的事件类型。

      The type of event to remove.

      可选,要移除的事件处理函数。

      Optional, the event handler function to remove.