asynchronize
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -5,3 +5,13 @@ /*global define */ | ||
// Utilities | ||
// --------- | ||
// process.nextTick polyfill for browsers | ||
var nextTick = ( | ||
typeof process !== 'undefined' && | ||
process.platform && | ||
process.nextTick | ||
) || setTimeout; | ||
// Asynchronize Function | ||
@@ -31,14 +41,19 @@ // --------------------- | ||
// Get the result of the function call | ||
try { | ||
result = fn.apply(null, args); | ||
} catch (err) { | ||
error = err; | ||
} | ||
// Defer execution | ||
nextTick(function () { | ||
// Callback (if there is one) | ||
if (next) { | ||
next(error, result); | ||
} | ||
// Get the result of the function call | ||
try { | ||
result = fn.apply(null, args); | ||
} catch (err) { | ||
error = err; | ||
} | ||
// Callback (if there is one) | ||
if (next) { | ||
next(error, result); | ||
} | ||
}); | ||
}; | ||
@@ -45,0 +60,0 @@ |
{ | ||
"name": "asynchronize", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
@@ -5,0 +5,0 @@ "description": "Make synchronous functions look asynchronous", |
@@ -7,3 +7,3 @@ | ||
**Current Version:** *1.0.1* | ||
**Current Version:** *1.1.0* | ||
**Build Status:** [![Build Status][travis-status]][travis] | ||
@@ -10,0 +10,0 @@ **Node Support:** *0.6, 0.8, 0.10* |
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
7801
61