Skip to main content

ConcurrentEvent <Args, Scope>

Hierarchy

  • BaseEvent<Promise<unknown>, Args, Scope>
    • ConcurrentEvent

Index

Constructors

constructor

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

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

Properties

listeners

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

name

name: string

Methods

clearListeners

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

emit

  • emit(args: Args, scope?: Scope): Promise<unknown[]>
  • Asynchronously execute listeners for with the defined arguments. Will return a promise with an array of each listener result.

getListeners

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