Let it work with browserify

Export to module.exports if it exists, even if window exists too. Lets it work with browserify. Seems to build fine and passes tests.