| Method Name | Method Signature | Description |
|---|---|---|
| <constructor> | new Timer( ) | Contructor. parameters none. returns new timer object. |
| new Timer(millis) | Contructor. parameters millis: interval in milliseconds. default value 1000. returns new timer object. |
|
| new Timer(millis, callback) | Constructor. parameters millis: interval in milliseconds. default value 1000. callback: callback function to call after interval. returns new timer object. |
|
| addCallback | addCallback(callback) | Adds a new callback function. parameters callback: callback function to call after interval. returns current timer object. |
| addCallback(callback, N) | Adds a new callback function. parameters callback: callback function to call after N'th interval. N: integer number greater than or equal to 1. returns current timer object. |
|
| clearCallbacks | clearCallbacks( ) | Remove all callback functions added previously. parameters none. returns current timer object. |
| interval | interval( ) | Gets timer's interval. parameters none. returns integer, interval in milliseconds. |
| interval(millis) | Sets timer's interval. parameters millis: integer, interlval in milliseconds. returns current timer object. |
|
| isPaused | isPaused( ) | Checks if the timer is paused. Paused and stopped are two different states. parameters none. returns boolean (true or false). |
| isStopped | isStopped( ) | Checks if the timer is stopped. Paused and stopped are two different states. parameters none. returns boolean (true or false). |
| pause | pause( ) | Pauses the timer. parameters none. returns current timer object. |
| restart | restart( ) | Restarts the timer. Shorthand for stop( ) and then start( ). parameters none. returns current timer object. |
| resume | resume( ) | Resumes the timer from the state it was paused. If timer was not paused, resume has no effect. parameters none. returns current timer object. |
| runOnce | runOnce( ) | Tells if timer is set to run once. parameters none. returns true if timer is set to run once, false otherwise. |
| runOnce(isRunOnce) | Sets the timers execution mode. parameters isRunOnce: boolean, true sets the timer to run once, false sets to run forever. returns current timer object. |
|
| start | start( ) | Starts the timer initially or if it was stopped. If timer was paused, start work as resume. parameters none. returns current timer object. |
| stop | stop( ) | Stops the timer. parameters none. returns current timer object. |