Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/postal.when.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/**
* postal.when - A postal.js add-on enabling an aggregated response to a group of messages.
* Author: Jim Cowart (http://freshbrewedcode.com/jimcowart)
* Version: v0.2.0
* Version: v0.3.0
* Url: http://github.com/postaljs/postal.when
* License(s): MIT
*/
(function (root, factory) {
if (typeof module === "object" && module.exports) {
// Node, or CommonJS-Like environments
module.exports = function (postal) {
return factory(require("underscore"), postal, this);
return factory(require("lodash"), postal, this);
}
} else if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
define(["underscore", "postal"], function (_, postal) {
define(["lodash", "postal"], function (_, postal) {
return factory(_, postal, root);
});
} else {
Expand All @@ -31,7 +31,7 @@
_timeoutFn = setTimeout(function () {
_onError({
type: "timeout",
data: _.pluck(_subscriptions, "data")
data: _.map(_subscriptions, "data")
});
}, _options.timeout);
}
Expand All @@ -42,9 +42,9 @@
});
},
_checkFired = function () {
var _data = _.pluck(_subscriptions, "data"),
var _data = _.map(_subscriptions, "data"),
_fn;
if (_.all(_data, _.identity)) {
if (_.every(_data, _.identity)) {
clearTimeout(_timeoutFn);
onSuccess.apply(this, _data);
if (_options.once) {
Expand Down Expand Up @@ -76,4 +76,4 @@
return new ForkJoin(queue, onSuccess, onError, options);
};
return postal;
}));
}));