Comparing version 0.0.12 to 0.0.14
@@ -10,3 +10,15 @@ var EventEmitter = require('events').EventEmitter, | ||
var runFn = function(event, callback, args) { | ||
if(!!listeners[callback].emit) { | ||
listeners[callback].emit.apply(listeners[callback], [event].concat(args)); | ||
} else { | ||
listeners[callback].apply(this, args); | ||
} | ||
} | ||
var runErr = function(args) { | ||
runFn("error", "error", args); | ||
} | ||
var fn = function() { | ||
@@ -30,8 +42,7 @@ | ||
//error should always be first args | ||
var err = args.shift(); | ||
var e = args.shift(); | ||
//on error | ||
if(err) { | ||
listeners.error.call(this, err); | ||
if(e) { | ||
runErr.call(this, [e]); | ||
} else | ||
@@ -41,5 +52,5 @@ | ||
try { | ||
listeners.success.apply(this, args); | ||
runFn.call(this, "complete", "success", args); | ||
} catch(e) { | ||
listeners.error.call(this, err) | ||
runErr.call(this, [e]); | ||
} | ||
@@ -133,2 +144,6 @@ } | ||
module.exports.once = function() { | ||
globalEmitter.once.apply(globalEmitter, arguments); | ||
} | ||
//bleh this could be better. Need to copy the chain functions to the module.exports var | ||
@@ -135,0 +150,0 @@ var chain = Chain(); |
@@ -10,7 +10,13 @@ { | ||
"repository": {}, | ||
"version": "0.0.12", | ||
"version": "0.0.14", | ||
"engines": {}, | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"devDependencies": { | ||
"expect.js": "0.2.x", | ||
"mocha":"1.8.x" | ||
}, | ||
"scripts": { | ||
"test": "mocha --reporter min" | ||
}, | ||
"main": "./lib/index.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
38461
12
855
2