Options
All
  • Public
  • Public/Protected
  • All
V1.7
  • V1.6
  • V1.7
Menu

Class Timer

Timer handles are used to schedule callbacks to be called in the future.

Wrapper for uv_timer_t. See http://docs.libuv.org/en/v1.x/timer.html

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

repeat

repeat: number

Get or set the repeat value in milliseconds. The timer will be scheduled to run on the given interval, regardless of the callback execution duration, and will follow normal timer semantics in the case of a time-slice overrun.

Wrapper for uv_timer_set_repeat and uv_timer_get_repeat exposed as a writable JS property.

Methods

again

  • again(): void
  • Stop the timer, and if it is repeating restart it using the repeat value as the timeout. If the timer has never been started before it throws UV_EINVAL.

    Wrapper for uv_timer_again.

    Returns void

close

  • close(onClose?: () => void): void
  • Request handle to be closed.

    Wrapper for uv_close.

    Parameters

    • Optional onClose: () => void
        • (): void
        • Returns void

    Returns void

hasRef

  • hasRef(): boolean
  • Returns true if the handle referenced, false otherwise.

    Wrapper for uv_has_ref.

    Returns boolean

ref

  • ref(): void

start

  • start(onTimeout: () => void, timeout: number, repeat: number): void
  • Start the timer. timeout and repeat are in milliseconds.

    If timeout is zero, the callback fires on the next event loop iteration. If repeat is non-zero, the callback fires first after timeout milliseconds and then repeatedly after repeat milliseconds.

    Wrapper for uv_timer_start.

    Parameters

    • onTimeout: () => void
        • (): void
        • Returns void

    • timeout: number
    • repeat: number

    Returns void

stop

  • stop(): void
  • Stop the timer, the callback will not be called anymore.

    Wrapper for uv_timer_stop.

    Returns void

unref

  • unref(): void

Generated using TypeDoc