Skip to main content

BailEvent <Args, Scope>

Hierarchy

  • BaseEvent<boolean | void, Args, Scope>
    • BailEvent

Index

Constructors

constructor

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

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

Properties

listeners

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

name

name: string

Methods

clearListeners

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

emit

  • emit(args: Args, scope?: Scope): boolean
  • Synchronously execute listeners with the defined arguments. If a listener returns false, the loop with be aborted early, and the emitter will return true (for bailed).

getListeners

  • getListeners(scope?: Scope): Set<Listener<Args, boolean | void>>
  • 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, boolean | void>, scope?: Scope): this
  • Remove a listener from the event.