Object representing a timer. You should not instantiate these yourself, but rather, use the methods in hs.timer to create them for you.

Properties

interval

number

The timer's interval in seconds

repeats

boolean

Whether the timer repeats

Methods

start()

Start the timer

Parameters

None

Returns

Nothing

stop()

Stop the timer

Parameters

None

Returns

Nothing

fire()

Immediately fire the timer's callback

Parameters

None

Returns

Nothing

running()

Check if the timer is currently running

Parameters

None

Returns

boolean - true if the timer is running, false otherwise

nextTrigger()

Get the number of seconds until the timer next fires

Parameters

None

Returns

number - Seconds until next trigger, or a negative value if the timer is not running

setNextTrigger(seconds)

Set when the timer should next fire

Parameters

  • seconds number

    Number of seconds from now when the timer should fire

Returns

Nothing