Comparing version 2.1.1 to 2.2.0
@@ -17,3 +17,3 @@ (function () { | ||
function future(global_context) { | ||
function future(global_context, options) { | ||
var everytimers = {}, | ||
@@ -35,2 +35,6 @@ onetimers = {}, | ||
options = options || {}; | ||
options.error = options.error || function (err) { | ||
throw err; | ||
}; | ||
@@ -102,3 +106,4 @@ function resetTimeout() { | ||
if (true !== new_asap && false !== new_asap) { | ||
throw new Error("Future.setAsap(asap) accepts literal true or false, not " + new_asap); | ||
options.error(new Error("Future.setAsap(asap) accepts literal true or false, not " + new_asap)); | ||
return; | ||
} | ||
@@ -169,3 +174,4 @@ asap = new_asap; | ||
if (fulfilled) { | ||
throw new Error("`Future().fulfill(err, data, ...)` renders future deliveries useless"); | ||
options.error(new Error("`Future().fulfill(err, data, ...)` renders future deliveries useless")); | ||
return; | ||
} | ||
@@ -222,3 +228,4 @@ var args = Array.prototype.slice.call(arguments); | ||
if ('function' !== typeof callback) { | ||
throw new Error("Future().whenever(callback, [context]): callback must be a function."); | ||
options.error(new Error("Future().whenever(callback, [context]): callback must be a function.")); | ||
return; | ||
} | ||
@@ -228,3 +235,3 @@ | ||
// TODO log | ||
throw new Error("Future().everytimers is a strict set. Cannot add already subscribed `callback, [context]`."); | ||
options.error(new Error("Future().everytimers is a strict set. Cannot add already subscribed `callback, [context]`.")); | ||
return; | ||
@@ -290,5 +297,5 @@ } | ||
function Future(context) { | ||
function Future(context, options) { | ||
// TODO use prototype instead of new | ||
return (new future(context)); | ||
return (new future(context, options)); | ||
} | ||
@@ -295,0 +302,0 @@ |
{ | ||
"name": "future", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "The promise / subscribe / deferred module of FuturesJS (Ender.JS and Node.JS)", | ||
@@ -19,4 +19,5 @@ "homepage": "https://github.com/coolaj86/futures", | ||
"engines": { | ||
"node": "*" | ||
"node": "*", | ||
"ender": ">= 0.5.0" | ||
} | ||
} |
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
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
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
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
9498
3
218
0
81
0
1