Skip to content

Instantly share code, notes, and snippets.

@8lane
Created June 27, 2017 12:46
Show Gist options
  • Save 8lane/4f3ff9fada784d66f447c8ff13028628 to your computer and use it in GitHub Desktop.
Save 8lane/4f3ff9fada784d66f447c8ff13028628 to your computer and use it in GitHub Desktop.
try {
data = JSON.parse(data);
if (data.length > 0) {
if (data[0].timestamp === _this.lastTimestamp) {
_this.itemIndex = 0;
_this.lastTimestamp = null;
_this.isPolling = false;
_this.startPoll();
} else {
_this.addItem(data[0], temp).then(function() {
_this.itemIndex = _this.itemIndex + 1;
_this.lastTimestamp = data[0].timestamp;
_this.isPolling = false;
_this.startPoll();
});
}
} else {
_this.isPolling = false;
_this.poll(true);
}
} catch (e) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment