summaryrefslogtreecommitdiff
path: root/lib/ensureAsync.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ensureAsync.js')
-rw-r--r--lib/ensureAsync.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ensureAsync.js b/lib/ensureAsync.js
index 8b7b208..ae5f131 100644
--- a/lib/ensureAsync.js
+++ b/lib/ensureAsync.js
@@ -7,6 +7,7 @@ import setImmediate from './internal/setImmediate';
export default function ensureAsync(fn) {
return rest(function (args) {
var callback = args.pop();
+ var sync = true;
args.push(function () {
var innerArgs = arguments;
if (sync) {
@@ -17,7 +18,6 @@ export default function ensureAsync(fn) {
callback.apply(null, innerArgs);
}
});
- var sync = true;
fn.apply(this, args);
sync = false;
});