Makes module compatible with CommonJS.

So that you can use browserify or some other CommonJS packager. Still works with `window` globals as before.