Comparing version 0.2.0 to 0.2.1
@@ -259,6 +259,9 @@ (function(root, factory) { | ||
// Handles a single packet of data. The data is expected to be JSON, and if | ||
// it isn't, an error will be triggered through the event handler. | ||
// Otherwise, an event of the packet's "type" will be triggered with the | ||
// packet data being passed. | ||
// it isn't, a `type.error` event will be emitted. Otherwise, an event for | ||
// each of the meta fields (e.g., `type.error`, `group.someGroup`, | ||
// `replyTo.SOME_ID`) will be emitted. | ||
// | ||
// In addition, non-error packets will be emitted to the `*` event and, if no | ||
// listeners were fired for the packet, to the `*.unhandled` event. | ||
// | ||
// In the future, this will also be responsible for handling "special" | ||
@@ -284,5 +287,10 @@ // packets like heartbeats, etc. that are kept separate from the primary | ||
_.each(packet.meta, function(value, key) { | ||
this.emit(key + '.' + value, packet.data, packet.meta); | ||
var handled = _.map(packet.meta, function(value, key) { | ||
return this.emit(key + '.' + value, packet.data, packet.meta); | ||
}.bind(this)); | ||
this.emit('*', packet.data, packet.meta); | ||
if (!_.any(handled)) { | ||
this.emit('*.unhandled', packet.data, packet.meta); | ||
} | ||
}; | ||
@@ -289,0 +297,0 @@ |
{ | ||
"name": "help-esb", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A client for the Help.com team's ESB.", | ||
@@ -5,0 +5,0 @@ "main": "help-esb.js", |
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
21402
11
335
5