Skip to main content

WaterfallEvent <Arg, Scope>

Hierarchy

Index

Constructors

constructor

  • new WaterfallEvent<Arg, Scope>(name: string): WaterfallEvent<Arg, Scope>
  • Type parameters

    • Arg
    • Scope: string = string

Properties

listeners

listeners: Map<* | Scope, Set<(a1: Arg) => Arg>> = ...

name

name: string

Methods

clearListeners

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

emit

  • emit(arg: Arg, scope?: Scope): Arg
  • Synchronously execute listeners with the defined argument value. The return value of each listener will be passed as an argument to the next listener.

getListeners

  • getListeners(scope?: Scope): Set<(a1: Arg) => Arg>
  • Return a set of listeners for a specific event scope.

getScopes

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

listen

  • listen(listener: (a1: Arg) => Arg, scope?: Scope): Unlistener
  • Register a listener to the event.

once

  • once(listener: (a1: Arg) => Arg, scope?: Scope): Unlistener
  • Register a listener to the event that only triggers once.

unlisten

  • unlisten(listener: (a1: Arg) => Arg, scope?: Scope): this
  • Remove a listener from the event.