Options
All
  • Public
  • Public/Protected
  • All
Menu

The EventSlot class defines an event with custom parameters as members of classes without the need for the classes to derive from EventTarget and use string names for events. Multiple listeners can be added/removed to/from an event.

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

Methods

attach

  • attach(listener: TFunc): void
  • Adds the given function as a listener to the event.

    Parameters

    • listener: TFunc

    Returns void

clear

  • clear(): void

detach

  • detach(listener: TFunc): void
  • Removes the given function as a listener to the event.

    Parameters

    • listener: TFunc

    Returns void

fire

  • fire(...args: Parameters<TFunc>): void
  • Method that raises the event and calls all the listeners (if any). It has the signature of the template function so only proper-types parameters can be passed to it.

    Parameters

    • Rest ...args: Parameters<TFunc>

    Returns void

has

  • has(): boolean
  • Determines whether this event slot has any listeners.

    Returns boolean