Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Emitter<T>

An Emitter is based around the idea of an event listener allowing you to emit values to listeners.

The WECU Emitter can be used without making use of WECU Components.

Type parameters

  • T

Hierarchy

  • Emitter

Index

Constructors

Properties

callbacks: ((value: T) => void)[] = []

Methods

  • emit(value: T): void
  • The emit method invokes the listners, passing them the value parameter as their argument.

    arg

    value The value to be passed to the listeners.

    Parameters

    • value: T

    Returns void

  • emitSync(value: T): void
  • This method syncronously invokes all of the listeners.

    Parameters

    • value: T

    Returns void

  • onEmit(cb: (value: T) => void): void
  • This method is used to register listeners which will be invoked when the emit method is called.

    Parameters

    • cb: (value: T) => void
        • (value: T): void
        • Parameters

          • value: T

          Returns void

    Returns void

  • removeListener(cb: (value: T) => void): void
  • This method will remove a listener from the list of callbacks

    Parameters

    • cb: (value: T) => void
        • (value: T): void
        • Parameters

          • value: T

          Returns void

    Returns void

Generated using TypeDoc