'ReferenceError: window is not defined' error fix

Running `node test.js` would fail as `window` is not a global variable.

This PR does two things:

- the module is now testable in a non-browser environment
- the module sets its dependency on the global `window` object through the [global](https://www.npmjs.org/package/global) module

![](http://ljdchost.com/pD99niY.gif)