Skip to content

Commit

Permalink
Merge pull request #527 from trusktr/patch-1
Browse files Browse the repository at this point in the history
Better support for require.js
  • Loading branch information
aearly committed May 19, 2015
2 parents 57cf750 + ddcee3e commit 7c7ca9b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7c7ca9b

Please sign in to comment.