Table of Contents

Javascript binding API - Ecore Poller

Back to the JS Ecore page

DRAFT

The Poller module provides infrastructure for creation of pollers.

Pollers are, in essence, callbacks that share a single timer per type. Because not all pollers need to be called at the same frequency the user may specify the frequency in ticks(each expiration of the shared timer is called a tick, in ecore poller parlance) for each added poller. Ecore pollers should only be used when the poller doesn't have specific requirements on the exact times to poll.

This architecture means that the main loop is only woken up once to handle all pollers of that type, this will save power as the CPU has more of a chance to go into a low power state the longer it is asleep for, so this should be used in situations where power usage is a concern.

For now, only 1 core poller type is supported: efl.Ecore.Poller.CORE, the default interval for efl.Ecore.Poller.CORE is 0.125(or 1/8th) second.

The creation of a poller is extremely simple and only requires one line:

efl.Ecore.Poller.add(efl.Ecore.Poller.CORE, 1, my_poller_function);

This sample creates a poller to call my_poller_function at every tick.

Constants

Functions

add(pollerType, interval, callback)

Syntax

function mycallback() { ...};
var poller = efl.Ecore.Poller.add(pollerType, interval, mycallback);

Parameters

Return value

pollerObject.del()

Syntax

pollerObj.del();

Deletes the callee poller object from the pollers list.

getPollInterval(type)

Syntax

    var interval = efl.Ecore.Poller.getPollInterval(type);

Parameters

Return value

Gets the interval in seconds between successive ticks of the given poller type.

setPollInterval(type, interval)

Syntax

efl.Ecore.Poller.setPollInterval(type, poll_time);

Parameters

Sets the interval (in seconds) between successive ticks for the poller type type.