Class EventWatcher

The EventWatcher class is utilized to handle events. When an event watcher emits an event, all of the callback functions bound to the event are called synchronously.

Hierarchy

Constructors

Properties

Accessors

Methods

Constructors

  • Constructs an event watcher.

    Returns EventWatcher

Properties

m_blocked: boolean = false
m_events: Map<string, ((...data) => void)> = ...

Type declaration

    • (...data): void
    • Parameters

      • Rest ...data: any[]

      Returns void

s_sender: EventWatcher

Accessors

  • get blocked(): boolean
  • Returns true if events are blocked; otherwise returns false.

    Returns boolean

  • set blocked(blocked): void
  • If blocked is true, then events emitted by this event watcher will be blocked, meaning that emitting an event will not trigger any callback functions that are bound to it.

    Parameters

    • blocked: boolean

    Returns void

  • get sender(): EventWatcher
  • Returns the object that sent the event.

    Returns EventWatcher

Methods

  • Adds a callback function that's going to be called when the event is emitted.

    Type Parameters

    Parameters

    • name: K
    • callback: ((...data) => void)
        • (...data): void
        • Parameters

          Returns void

    Returns void

  • Parameters

    • name: string
    • callback: ((...data) => void)
        • (...data): void
        • Parameters

          • Rest ...data: any[]

          Returns void

    Returns void

  • Delegates this event watcher to handle the given watcher's event named name.

    Type Parameters

    Parameters

    Returns void

  • Parameters

    Returns void

  • Emits an arbitrary set of arguments to the callback function which is bound to the event named name.

    Type Parameters

    Parameters

    Returns boolean

  • Parameters

    • name: string
    • Rest ...data: any[]

    Returns boolean

  • Removes the specified watcher for the event named name.

    Type Parameters

    Parameters

    • name: K

    Returns void

  • Parameters

    • name: string

    Returns void

Generated using TypeDoc