2015-07-19 21:08:17 +00:00
|
|
|
/*
|
|
|
|
|
* Hack to allow nodejs require("package/file") in the browser
|
|
|
|
|
* How?
|
|
|
|
|
* Since every require is used as an object:
|
|
|
|
|
* `require("./utils.js").Utils` // (notice the `.Utils`)
|
|
|
|
|
*
|
|
|
|
|
* We can say that when there is no require method
|
|
|
|
|
* we use the global object in which the `Utils`
|
|
|
|
|
* object was already injected.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
var $globalHolder = (typeof module !== 'undefined' && module.exports) ||
|
|
|
|
|
(typeof exports !== 'undefined' && exports) ||
|
|
|
|
|
(typeof window !== 'undefined' && window) ||
|
|
|
|
|
(typeof self !== 'undefined' && self) ||
|
|
|
|
|
(typeof this !== 'undefined' && this) ||
|
|
|
|
|
Function('return this')();
|
2015-04-12 01:59:54 +00:00
|
|
|
function require() {
|
2015-07-19 21:08:17 +00:00
|
|
|
return $globalHolder;
|
|
|
|
|
}
|