Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Eventer

Pub/Sub for internal event scheduling. All functions are for protected usage. Sub class can use them for implementation of event dispaching.

property

id Unique Eventer id

Hierarchy

  • Eventer

Index

Constructors

Properties

Methods

Constructors

constructor

  • Returns Eventer

Properties

Readonly id

id: number = ++lastId

Unique id

Methods

allOff

  • allOff(): this
  • Remove all topics with all listeners

    Returns this

emit

  • emit(topic: string, ...args: Array<any>): number
  • Emit event and call subscribed listeners

    Parameters

    • topic: string

      Topic name

    • Rest ...args: Array<any>

      Array of arguments

    Returns number

    Number of listeners called

has

  • Check if listener with provided token exists

    Parameters

    • token: Token

      Token of desired listener

    • Optional topic: undefined | string

      Topic which has to contain the listener

    Returns EventError | Listener

    Error with message or Listener

listeners

  • Get All listeners at the topic

    Parameters

    • topic: string

      Topic name

    Returns Map<Token, Listener>

off

  • off(token: Token, topic?: undefined | string): boolean
  • Remove listener with provided token

    Parameters

    • token: Token

      Token of the listener

    • Optional topic: undefined | string

      Topic which has to contain the listener

    Returns boolean

    True if the listener is successfully removed and false if it is not found

on

  • Register subscription on the topic with provided listener

    Parameters

    • topic: string

      Topic name

    • listener: Listener

      Event listener

    • Optional oldToken: Token

      Old token, if it has to be reused

    Returns Token

topicOff

  • topicOff(topic: string): boolean
  • Remove topic with all listeners

    Parameters

    • topic: string

      Topic name

    Returns boolean

    True if the topic is successfully removed and false if it is not found