Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventListener<EventName>

Class associating an event handler with an event.

Type parameters

Hierarchy

  • EventListener

Implements

Index

Constructors

Properties

Accessors

Constructors

constructor

Properties

Optional computedListener

computedListener: (...args: ClientEvents[EventName]) => void

The actual function registered to the client as the direct listener. This function gets the context object from the client and runs the user listener with the event arguments and the context object.

internal

This property should not be used by consumers. In the future, it is likely that event handlers will be restructured to avoid having multiple actual functions handling the same event, and this intermediate step will be unnecessary.

Type declaration

    • The actual function registered to the client as the direct listener. This function gets the context object from the client and runs the user listener with the event arguments and the context object.

      internal

      This property should not be used by consumers. In the future, it is likely that event handlers will be restructured to avoid having multiple actual functions handling the same event, and this intermediate step will be unnecessary.

      Parameters

      Returns void

eventName

eventName: EventName

The name of the event this listener is attached to

Optional filename

filename: string

The name of the file the event listener was loaded from, if any.

listener

listener: (...args: [...ClientEvents[EventName][], EventContext]) => void

The function run when the event is emitted

Type declaration

once

once: boolean

If true, the listener is only called the first time the event occurs

Accessors

args

  • get args(): [this["eventName"], this["listener"]]
  • The arguments passed to client.on() to register this listener

    deprecated

    This property is no longer used internally and is only provided as a getter for backwards compatibility. Notably, its second argument has never referred to the actual function instance registered on the client; reference eventName and listener directly instead.

    Returns [this["eventName"], this["listener"]]

Generated using TypeDoc