data-updater
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -11,2 +11,6 @@ var dataUpdater = require('../index.js'); | ||
updater.on('first-successful-update', function(err) { | ||
console.log('first-successful-update'); | ||
}); | ||
updater.on('update', function(data) { | ||
@@ -24,3 +28,5 @@ console.log('update', data); | ||
updater.start(); | ||
updater.start(function() { | ||
console.log('Started'); | ||
}); | ||
@@ -27,0 +33,0 @@ setTimeout(function() { |
@@ -16,2 +16,3 @@ var _ = require('lodash'); | ||
this._firstUpdate = true; | ||
this._firstSuccessfulUpdate = true; | ||
this._timeoutRef = null; | ||
@@ -31,3 +32,3 @@ this._updating = false; | ||
if (cb !== undefined) { | ||
this.once('first-update', cb); | ||
this.once('first-successful-update', cb); | ||
} | ||
@@ -121,4 +122,8 @@ this._update(); | ||
} | ||
if (!err && this._firstSuccessfulUpdate) { | ||
this._firstSuccessfulUpdate = false; | ||
this.emit('first-successful-update'); | ||
} | ||
}; | ||
module.exports = DataUpdater; |
{ | ||
"name": "data-updater", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
8004
278