lib/poller.js
function Poller(getRequest, options) {
    options = options || { };
    events.EventEmitter.call(this);
    this._pollerOptions = utils.getPollerOptions([utils.setup().poller, options]);
    this._get = getRequest;
    this._params = options.params || { };
    this._lastreadId = this._params.lastreadId || null;
    this._timer = null;
    this._requestPending = false;
    this._paused = false;
    return this;
}
function Poller(getRequest, options) {
    options = options || { };
    events.EventEmitter.call(this);
    this._pollerOptions = utils.getPollerOptions([utils.setup().poller, options]);
    this._get = getRequest;
    this._params = options.params || { };
    this._lastreadId = this._params.lastreadId || null;
    this._timer = null;
    this._requestPending = false;
    this._paused = false;
    return this;
}
function Poller ( getRequest , options ) { options = options || { } ; events . EventEmitter . call ( this ) ; this . _pollerOptions = utils . getPollerOptions ( [ utils . setup ( ) . poller , options ] ) ; this . _get = getRequest ; this . _params = options . params || { } ; this . _lastreadId = this . _params . lastreadId || null ; this . _timer = null ; this . _requestPending = false ; this . _paused = false ; return this ; }
Poller Class. Inherits from events.EventEmitter. This poller
is designed in that it polls for new items automatically
without having you implement `lastreadId` logic.

@example
// create a new poller that keeps retrieiving traffic updates
var poller = new sdk.Poller(sdk.trafficUpdates.get, {
interval: 5000, // 5 seconds
});

// listen for new updates
poller.on("message", function(updates, meta, responseObject) {
console.log("received these updates: %j", updates);
});

// listen for errors e.g. network failures etc.
// if an error occurs an you not listening on the "error"
// event, the error will bubble up to the domain/process.
poller.on("error", function(err) {
console.log("error: %s", err);
});

// you have to explicitly start it
poller.start();

// lets say we close it after a minute or so
setTimeout(function() {
poller.stop();
}, 1000 * 60);

@constructor
@param  {itemsGetRequest} getRequest - request function fired in each poll
@param  {Object} [options]
@param  {Object|Function} [options.params] - parameters passed to get request.
If `options.params` is a function, it is invoked and its return value is
assumed an object as the request params.
If `options.params` requires to do an asynchronous action, it is passed a
`done` function as its only argument to call with the value when done.
@param  {Integer} [options.interval=5000] - configures the poller's timer
Poller Class . Inherits from events . EventEmitter . This poller is designed in that it polls for new items automatically without having you implement lastreadId logic .