Helps grabbing the global object. Works in a browser window
, in node.js global
, in Web Workers self
.
Usage with curl.js
Your AMD module should depend on AMD global:
// Uses AMD or browser globals to create a jQuery plugin.
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery', 'amd-global'], factory);
} else {
// Browser globals
factory(jQuery, this);
}
}(function ($, global, undefined) {
...
}));
You can read about it in this SO question
Idea of unscriptable and briancavalier.
Available in the Bower Registry
bower install amd-global