ma3route-sdk
Advanced tools
Comparing version 0.8.3 to 0.8.4
@@ -11,2 +11,15 @@ | ||
## 0.8.4 - 27/02/2016 | ||
Changed: | ||
* Poller emits `"message"` event only when one or more items are returned from API | ||
* Poller only fires request, if there's **none** pending | ||
Fixed: | ||
* Poller should use the correct last read ID, irrespective of the order of returned items | ||
## 0.8.3 - 17/02/2016 | ||
@@ -13,0 +26,0 @@ |
@@ -73,2 +73,3 @@ /** | ||
this._timer = null; | ||
this._requestPending = false; | ||
return this; | ||
@@ -89,13 +90,26 @@ } | ||
me._get(args, function(err, items, meta, res) { | ||
me._requestPending = false; | ||
if (err) { | ||
return me.emit("error", err); | ||
} | ||
// save the last read id | ||
// emit 'message' event if we received items | ||
if (items.length) { | ||
me._params.lastreadId = items[items.length - 1].id; | ||
// since we do not know if we are in ascending or descending | ||
// order, please do check | ||
var id1 = items[0].id; | ||
var id2 = items[items.length - 1].id; | ||
me._params.lastreadId = id1 > id2 ? id1 : id2; | ||
return me.emit("message", items, meta, res); | ||
} | ||
return me.emit("message", items, meta, res); | ||
return null; | ||
}); | ||
} | ||
me._timer = setInterval(function() { | ||
// only send request, if there is none pending | ||
if (me._requestPending) { | ||
return null; | ||
} | ||
me._requestPending = true; | ||
var args = { }; | ||
@@ -102,0 +116,0 @@ if (me._lastreadId) { |
{ | ||
"name": "ma3route-sdk", | ||
"version": "0.8.3", | ||
"version": "0.8.4", | ||
"description": "Node.js SDK for developing with the Ma3Route REST API", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43659
1319