Prefer module global reference rather than window
Check if attachEvent is defined
Merge pull request #177 from josh/browser-global

Prefer module provided `global` rather than `window` reference