Skip to main content

abstractBaseEvent <Return, Args, Scope>

Hierarchy

Index

Constructors

constructor

  • new BaseEvent<Return, Args, Scope>(name: string): BaseEvent<Return, Args, Scope>
  • Type parameters

    • Return
    • Args: unknown[]
    • Scope: string = string

Properties

listeners

listeners: Map<Scope | *, Set<Listener<Args, Return>>> = ...

name

name: string

Methods

clearListeners

  • clearListeners(scope?: Scope): this
  • Remove all listeners from the event.

abstractemit

  • emit(args: unknown, scope?: Scope): unknown
  • Emit the event by executing all scoped listeners with the defined arguments.

getListeners

  • getListeners(scope?: Scope): Set<Listener<Args, Return>>
  • Return a set of listeners for a specific event scope.

getScopes

  • getScopes(): (Scope | *)[]
  • Return a list of all scopes with listeners.

listen

  • Register a listener to the event.

once

  • Register a listener to the event that only triggers once.

unlisten

  • unlisten(listener: Listener<Args, Return>, scope?: Scope): this
  • Remove a listener from the event.