UNPKG

global-var

Version:

Get the correct 'global' variable for the current runtime environment (`window` in browser, `global` in node, etc)

51 lines (32 loc) 1.24 kB
# global-var ![Travis](https://img.shields.io/travis/AndreasPizsa/global-var.svg?style=flat-square) ![Coverage Status](https://img.shields.io/coveralls/AndreasPizsa/global-var.svg?style=flat-square) ![Downloads](https://img.shields.io/npm/dm/global-var.svg?style=flat-square) > Get the correct 'global' variable for the current runtime environment (`window` in browser, `global` in node, etc) ## Install Install with [npm](https://www.npmjs.com/) ```sh $ npm i global-var --save ``` ## Usage ```js var globals = require('global-var'); globals.setTimeout( function(){ console.log('Hello, world!'); }, 1000); // --> "Hello, world!" after 1000ms ``` ## Running tests Install dev dependencies: ```sh $ npm i -d && npm test ``` ## Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/AndreasPizsa/global-var/issues/new). ## Author **Andreas Pizsa** + [github/AndreasPizsa](https://github.com/AndreasPizsa) + [twitter/AndreasPizsa](http://twitter.com/AndreasPizsa) ## License Copyright © 2016 Andreas Pizsa Released under the MIT license. *** _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on February 16, 2016._