Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventEmitter<H, E>

Type parameters

  • H

  • E

Hierarchy

  • EventEmitter

Implements

Index

Constructors

constructor

  • Parameters

    • host: H

    Returns EventEmitter

Accessors

event

Methods

emit

  • emit<K>(event: K, ...args: ArgsOf<E[K]>): H
  • Type parameters

    • K: keyof E

    Parameters

    • event: K
    • Rest ...args: ArgsOf<E[K]>

    Returns H

emitAsync

  • emitAsync<K>(event: K, ...args: ArgsOf<E[K]>): any
  • Type parameters

    • K: keyof E

    Parameters

    • event: K
    • Rest ...args: ArgsOf<E[K]>

    Returns any

emitFirst

  • emitFirst<K>(event: K, ...args: ArgsOf<E[K]>): any
  • Type parameters

    • K: keyof E

    Parameters

    • event: K
    • Rest ...args: ArgsOf<E[K]>

    Returns any

emitFirstDefault

  • emitFirstDefault<K, D>(event: K, generateDefault: () => D, ...args: ArgsOf<E[K]>): any
  • Type parameters

    • K: keyof E

    • D

    Parameters

    • event: K
    • generateDefault: () => D
        • (): D
        • Returns D

    • Rest ...args: ArgsOf<E[K]>

    Returns any

emitReduce

  • emitReduce<K, A>(event: K, arg: A, ...args: Tail<ArgsOf<E[K]>>)

emitStream

  • emitStream<K>(event: K, ...args: ArgsOf<E[K]>): Stream<ReturnOf<E[K]>>
  • Type parameters

    • K: keyof E

    Parameters

    • event: K
    • Rest ...args: ArgsOf<E[K]>

    Returns Stream<ReturnOf<E[K]>>

hasHandlersForEvent

  • hasHandlersForEvent(...events: Array<keyof E>): boolean

subscribe

  • subscribe<K>(events: K, handler: keyof H | IterableOr<Handler<H, K extends any[] ? E[K[number]] : E[Extract<K, keyof E>]>>, priority?: number): H
  • Type parameters

    Parameters

    • events: K
    • handler: keyof H | IterableOr<Handler<H, K extends any[] ? E[K[number]] : E[Extract<K, keyof E>]>>
    • Default value priority: number = 0

    Returns H

unsubscribe

  • unsubscribe<K>(events: K, handler: keyof H | IterableOr<Handler<H, K extends any[] ? E[K[number]] : E[Extract<K, keyof E>]>>, priority?: number): boolean
  • Type parameters

    Parameters

    • events: K
    • handler: keyof H | IterableOr<Handler<H, K extends any[] ? E[K[number]] : E[Extract<K, keyof E>]>>
    • Default value priority: number = 0

    Returns boolean

until

waitFor

  • waitFor<K>(events: K, priority?: number): Promise<ArgsOf<K extends any[] ? E[K[number]] : E[Extract<K, keyof E>]>>
  • Type parameters

    Parameters

    • events: K
    • Default value priority: number = 0

    Returns Promise<ArgsOf<K extends any[] ? E[K[number]] : E[Extract<K, keyof E>]>>

Generated using TypeDoc