Constructor
new LoopingTimer(keyopt, cacheObjopt)
Constructor
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key |
string |
<optional> |
key for the backing map in the cache |
cacheObj |
object |
<optional> |
cache object to use (defaults to cache.private if key is provided) |
- Source:
Methods
cancel()
Cancels the timer if it exists and hasn't already terminated.
- Source:
expired()
Called when the timer expires. Calls the passed in function and
reschedules it based on the returned when value, or ends if null was
returned.
- Source:
Throws:
exception when the time returned by the looping function is in the past
getDuration() → {Duration}
- Source:
Returns:
of time left in the current loop of the timer
if it returns null LoopingTimer hasn't been started yet
if it returns a positive duration the next iteration of the loop is scheduled
if it returns a negative duration the loop has exited and the duration is how long ago it exited the loop.
- Type
- Duration
hasTerminated()
Returns true of the timer doesn't exist or has terminated.
- Source:
loop(func, when, nameopt)
Kicks off the timer loop. Schedules a timer to call func at when
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
func |
function | function to call at when, must return a when to continue the loop or null to stop | |
when |
* | any of the types supported by time.toZDT | |
name |
string |
<optional> |
timer name displayed in openHAB |
- Source: