In case other places also wanted to listen, I'd use an actual event listener here. `window.addEventListener` and `window.attachEvent`.