add window event listener