From b6a1336bcb0865d6d26224f9553b9e1886fe696e Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Tue, 21 May 2013 00:04:25 -0400 Subject: Fix async compatibility with Internet Explorer 10 This fixes async to work on Internet Explorer 10. Internet Explorer 10 requires that the `setImmediate` function is not called as a method. As such, it cannot simply be aliased as `async.setImmediate` and `async.nextTick` as `Invalid calling object` error will be encountered since `setImmediate` will be called with `this` set to `async`. --- lib/async.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/async.js b/lib/async.js index 46f4f50..cb6320d 100755 --- a/lib/async.js +++ b/lib/async.js @@ -75,8 +75,11 @@ //// nextTick implementation with browser-compatible fallback //// if (typeof process === 'undefined' || !(process.nextTick)) { if (typeof setImmediate === 'function') { - async.setImmediate = setImmediate; - async.nextTick = setImmediate; + async.nextTick = function (fn) { + // not a direct alias for IE10 compatibility + setImmediate(fn); + }; + async.setImmediate = async.nextTick; } else { async.nextTick = function (fn) { -- cgit v1.2.1