There's this snippet of code in the Async library:
if (typeof window == 'object' && this === window) {
root = window;
}
else if (typeof global == 'object' && this === global) {
root = global;
}
else {
root = this;
}
Is there any reason for all this code? Why didn't author just use root = this
?
The first condition is only valid when this === window
, so root = window
and root = this
should be equivalent. Same thing in the second condition, where root = global
should be equivalent to root = this
.
Am I missing something here?