Table Of Contents

Previous topic

system.Class

Next topic

util

This Page

timer

Constructor

class timer(duration, callback)
Arguments:
  • duration (number) – number of seconds to wait, may be fractional
  • callback (function) – callback to invoke after

Methods

clear()

Calling clear prevents the timer from ever re-firing again.

isSuspended()
Returns:Boolean corresponding to whether the timer is currently suspended.
resetTimer()
Param :numeric, specifying how long from now to go before re-firing the timer.
Returns:boolean.

This function takes in a single argument: when the callback should actually fire from now.

resume()

Calling this function on a timer makes it so that the timer’s associated callback will fire however many seconds from now the timer was initialized with.

suspend()

Calling suspend prevents the timer from firing again until it is resumed.