analytics-node
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -26,7 +26,8 @@ var _ = require('underscore'), | ||
this.initialized = false; | ||
this.lastFlush = null; | ||
this.queue = []; | ||
// No-op on error so we don't kill the server. | ||
this.on('error', function () {}); | ||
if (options) this.init(options); | ||
@@ -95,3 +96,3 @@ }; | ||
* @return {events.EventEmitter} Promise event emitter that emits 'flush' once | ||
* the message has been flushed, and 'err' when an error has occured. | ||
* the message has been flushed, and 'error' when an error has occured. | ||
* | ||
@@ -156,3 +157,3 @@ */ | ||
* @return {events.EventEmitter} Promise event emitter that emits 'flush' once | ||
* the message has been flushed, and 'err' when an error has occured. | ||
* the message has been flushed, and 'error' when an error has occured. | ||
* | ||
@@ -210,3 +211,3 @@ */ | ||
/** | ||
* Whenever a user triggers an event, you’ll want to track it. | ||
* Aliases an anonymous user into an identified user. | ||
* | ||
@@ -219,3 +220,3 @@ * @param {Object} options | ||
* @return {events.EventEmitter} Promise event emitter that emits 'flush' once | ||
* the message has been flushed, and 'err' when an error has occured. | ||
* the message has been flushed, and 'error' when an error has occured. | ||
* | ||
@@ -252,2 +253,3 @@ */ | ||
var promise = new events.EventEmitter(); | ||
promise.on('error', function(){}); | ||
@@ -291,3 +293,3 @@ var message = { | ||
// to conserve memory | ||
this.emit('err', | ||
this.emit('error', | ||
new Error('analytics-node client failed to enqueue message ' + | ||
@@ -392,3 +394,3 @@ 'because queue is full. Consider increasing queue ' + | ||
if (err) | ||
self.emit('err', err); | ||
self.emit('error', err); | ||
else | ||
@@ -398,4 +400,8 @@ self.emit('flush'); | ||
_.each(promises, function (promise) { | ||
if (err) promise.emit('err', err); | ||
else promise.emit('flush'); | ||
if (err) { | ||
// Check for listeners so there is no uncaught exception. | ||
if (promise.listeners('error').length > 0) promise.emit('error', err); | ||
} else { | ||
promise.emit('flush'); | ||
} | ||
}); | ||
@@ -402,0 +408,0 @@ |
{ | ||
"name": "analytics-node", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "The hassle-free way to integrate analytics into any node application.", | ||
@@ -5,0 +5,0 @@ "repository": "git://github.com/segmentio/analytics-node", |
@@ -251,3 +251,3 @@ | ||
client.on('err', function (err) { | ||
client.on('error', function (err) { | ||
@@ -254,0 +254,0 @@ should.exist(err); |
@@ -10,3 +10,3 @@ | ||
promise.once('err', function (err) { | ||
promise.once('error', function (err) { | ||
should.not.exist(err); | ||
@@ -13,0 +13,0 @@ done(err); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
25547
662
1