JSignage timer methods
From SpinetiX Support Wiki
jSignage.setTimeout()
Executes one time the callback function after the duration specified by ms
. Returns a handler to the timer in case it needs to be canceled before the execution.
$.setTimeout( callback, ms );
Returns: Timer Object
Parameters:
-
callback
- Type: Callback.
- The function to be executed after the duration specified by
ms
.
-
ms
- Type: Number. Default: 0.
- The number of milliseconds (thousandths of a second) that the callback function call should be delayed by.
jSignage.clearTimeout()
Cancels a timer created with the setTimeout
function.
$.clearTimeout( timer );
Returns: Undefined
Parameters:
-
timer
- Type: Timer Object.
- A handler to a timer created with
setTimeout
function.
jSignage.setInterval()
Executes repeatedly the callback function with a fixed time delay between each call. Returns a handle to the timer in case it needs to be canceled.
$.setInterval( callback, ms );
Returns: Timer Object
Parameters:
-
callback
- Type: Callback.
- The function to be executed repeatedly.
-
ms
- Type: Number.
- A positive number of milliseconds (thousandths of a second) to wait between calls to the callback function.
jSignage.setIntervalSync()
Added in firmware 3.0.6 release.
Executes repeatedly the callback function with a fixed time delay between each call, just like setInterval
function, except that the first call is done after a delay that is most probably shorter that the one provided as parameter, in order to synchronize together multiple timers having the same delay. Returns a handle to the timer in case it needs to be canceled.
$.setIntervalSync( callback, ms );
Returns: Timer Object
Parameters:
-
callback
- Type: Callback.
- The function to be executed repeatedly.
-
ms
- Type: Number.
- A positive number of milliseconds (thousandths of a second) to wait between calls to the callback function.
jSignage.clearInterval()
Cancels a timer created by setInterval
function.
$.clearInterval( timer );
Returns: Undefined
Parameters:
-
timer
- Type: Timer Object.
- A handler to a timer created with
setInterval
function.