Javascript binding API - Ecore Timer

Back to the JS Ecore page

DRAFT

The Timer module provides flexible timer functionality.

Functions

add(time, callback)

Syntax

function mycallback() { ... };
var timerObj = efl.Ecore.Timer.add(time, mycallback);

Parameters

Return value

Adds a new timer that will call callback after time seconds.

addLoop(time, callback)

Syntax

function mycallback() { ... };
var timerObj = efl.Ecore.Timer.addLoop(time, mycallback);

Parameters

Return value

Works like efl.Ecore.Timer.add, but the reference “now” time is the time that the main loop ceased waiting for timeouts and/or events to come in or for signals or any other interrupt source. Use this UNLESS you absolutely must get the current actual timepoint.

timerObj.del()

Syntax

timerObj.del();

Deletes the callee timer object from the list of active timers.

dump()

Syntax

var log = efl.Ecore.Timer.dump();

Return value

This function returns a human-readable text-based log for Ecore Timer events.

getPrecision()

Syntax

var precision = efl.Ecore.Timer.getPrecision();

Return value

Retrieves the current precision used by timer infrastructure.

setPrecision(precision)

Syntax

    efl.Ecore.Timer.setPrecision(precision);

Parameters

This sets the precision for all timers. The precision determines how much of a difference from the requested interval is acceptable. One common reason to use this function is to increase the allowed timeout and thus, decrease the precision of the timers, this is because less precise the timers result in the system waking up less often and thus consuming fewer resources.

Be aware that kernel may delay delivery even further, these delays are always possible due other tasks having higher priorities or other scheduler policies.

Example: We have 2 timers, one that expires in a 2.0s and another that expires in 2.1s, if precision is 0.1s, then the Ecore will request for the next expire to happen in 2.1s and not 2.0s and another one of 0.1 as it would before.

Ecore is smart enough to see if there are timers in the precision range, if it does not, in our example if no second timer in (T + precision) existed, then it would use the minimum timeout.