├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── console.js ├── document.js ├── package.json ├── process.js └── window.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .monitor 3 | .*.swp 4 | .nodemonignore 5 | releases 6 | *.log 7 | *.err 8 | fleet.json 9 | public/browserify 10 | bin/*.json 11 | .bin 12 | build 13 | compile 14 | .lock-wscript 15 | node_modules 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.8 4 | - 0.9 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Colingo. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # global 2 | 3 | 6 | 7 | Require global variables 8 | 9 | ## Example 10 | 11 | ```js 12 | var global = require("global") 13 | var document = require("global/document") 14 | var window = require("global/window") 15 | ``` 16 | 17 | ## Installation 18 | 19 | `npm install global` 20 | 21 | ## Contributors 22 | 23 | - Raynos 24 | 25 | ## MIT Licenced 26 | 27 | [1]: https://secure.travis-ci.org/Colingo/global.png 28 | [2]: http://travis-ci.org/Colingo/global 29 | [3]: http://ci.testling.com/Colingo/global.png 30 | [4]: http://ci.testling.com/Colingo/global 31 | -------------------------------------------------------------------------------- /console.js: -------------------------------------------------------------------------------- 1 | module.exports = console; 2 | -------------------------------------------------------------------------------- /document.js: -------------------------------------------------------------------------------- 1 | var topLevel = typeof global !== 'undefined' ? global : 2 | typeof window !== 'undefined' ? window : {} 3 | var minDoc = require('min-document'); 4 | 5 | var doccy; 6 | 7 | if (typeof document !== 'undefined') { 8 | doccy = document; 9 | } else { 10 | doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; 11 | 12 | if (!doccy) { 13 | doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; 14 | } 15 | } 16 | 17 | module.exports = doccy; 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "global", 3 | "version": "4.4.0", 4 | "description": "Require global variables", 5 | "keywords": [], 6 | "author": "Raynos ", 7 | "repository": "git://github.com/Raynos/global.git", 8 | "main": "window.js", 9 | "homepage": "https://github.com/Raynos/global", 10 | "contributors": [ 11 | { 12 | "name": "Raynos" 13 | } 14 | ], 15 | "bugs": { 16 | "url": "https://github.com/Raynos/global/issues", 17 | "email": "raynos2@gmail.com" 18 | }, 19 | "browser": { 20 | "min-document": false, 21 | "individual": false 22 | }, 23 | "dependencies": { 24 | "min-document": "^2.19.0", 25 | "process": "^0.11.10" 26 | }, 27 | "devDependencies": { 28 | "tape": "^2.12.0" 29 | }, 30 | "license": "MIT", 31 | "scripts": { 32 | "test": "node ./test", 33 | "build": "browserify test/index.js -o test/static/bundle.js", 34 | "testem": "testem" 35 | }, 36 | "testling": { 37 | "files": "test/index.js", 38 | "browsers": { 39 | "ie": [ 40 | "8", 41 | "9", 42 | "10" 43 | ], 44 | "firefox": [ 45 | "16", 46 | "17", 47 | "nightly" 48 | ], 49 | "chrome": [ 50 | "22", 51 | "23", 52 | "canary" 53 | ], 54 | "opera": [ 55 | "12", 56 | "next" 57 | ], 58 | "safari": [ 59 | "5.1" 60 | ] 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /process.js: -------------------------------------------------------------------------------- 1 | module.exports = require('process'); 2 | -------------------------------------------------------------------------------- /window.js: -------------------------------------------------------------------------------- 1 | var win; 2 | 3 | if (typeof window !== "undefined") { 4 | win = window; 5 | } else if (typeof global !== "undefined") { 6 | win = global; 7 | } else if (typeof self !== "undefined"){ 8 | win = self; 9 | } else { 10 | win = {}; 11 | } 12 | 13 | module.exports = win; 14 | --------------------------------------------------------------------------------