Use 'global' instead of window

global is provided by browserify to be `window` in normal windows or `self` in workers
Fixes #36