if not in browser, monkey-patch EventTarget event handlers to window