I\'m trying to define the global object in JavaScript in a single line as follows:
var global = this.global || this;
The above
Implementation independant version is not trivial
(function (global) {
// javascript framework
})(
this && this.global || // ringoJS
typeof root !== "undefined" && root || // node.js
typeof global !== "undefined" && global || // more node.js
typeof GLOBAL !== "undefined" && GLOBAL || // more node.js
typeof window !== "undefined" && window || // browsers
this // either undefined or some global default?
);
Your going to have to hard code in feature detection for every environment.