bind on window-opened & window-closed events