JSignage:Timers

From SpinetiX Support Wiki

Jump to: navigation, search

This page describes jSignage utility methods to set and clear timers. See also Helpers and Parsers.

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

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()

Available since 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

This page was last modified on 6 December 2018, at 22:35.