save to module.exports even if window is defined (for browserify)