add support for environments with both window and global

Browsers will always have `window` and possibly `global` with node-webkit (or similar).
Node will never have `window` but always have `global`.
Could even be simplified to:
```js
})(window || global);
```
Thoughts?