Class Timer

The Timer class provides repetitive and single-shot timers.

Hierarchy

Constructors

Properties

m_active: boolean = false
m_id: number
m_interval: number = 0
m_singleShot: boolean = false

Accessors

  • get active(): boolean
  • Returns true if the timer is running; otherwise returns false.

    Returns boolean

  • 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 interval(): number
  • Returns the timeout interval in milliseconds. The default value for this property is 0. A timer with a timeout interval of 0 will time out as soon as all the events in the system's event queue have been processed.

    Returns number

  • set interval(msec): void
  • Sets the timeout interval of this timer.

    Parameters

    • msec: number

    Returns void

  • get singleShot(): boolean
  • Returns whether the timer is a single-shot timer or not, the default value is false.

    Returns boolean

  • set singleShot(singleShot): void
  • Sets whether the timer is a single-shot timer or not.

    Parameters

    • singleShot: boolean

    Returns void

  • get timerId(): number
  • Returns the timer id.

    Returns number

  • 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

  • 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

  • Restarts this timer.

    Returns void

  • Starts this timer with a timeout of msec milliseconds.

    Parameters

    • Optional msec: number

    Returns void

  • Returns void

  • Stops this timer.

    Returns void

  • Removes the specified watcher for the event named name.

    Type Parameters

    Parameters

    • name: K

    Returns void

  • Parameters

    • name: string

    Returns void

Generated using TypeDoc