diff --git a/lib/async.js b/lib/async.js
index <HASH>..<HASH> 100644
--- a/lib/async.js
+++ b/lib/async.js
@@ -14,7 +14,16 @@
     // global on the server, window in the browser
     var root, previous_async;
 
-    root = this;
+    if (typeof window == 'object' && this === window) {
+        root = window;
+    }
+    else if (typeof global == 'object' && this === global) {
+        root = global;
+    }
+    else {
+        root = this;
+    }
+
     if (root != null) {
       previous_async = root.async;
     }
Better support for browsers.

In a RequireJS environment `this` doesn't refer to the `window` object, so async doesn't work there.