import { take } from "@redux-saga/core/effects" ; import { PlayerActions } from "@creature-chess/gamemode" ; export const preventAccidentalClose = function * ( ) { window . onbeforeunload = ( ) => "Are you sure you want to leave this page? There is currently no way to rejoin a game" ; yield take ( PlayerActions . quitGamePlayerAction . toString ( ) ) ; setTimeout ( ( ) => { window . onbeforeunload = null ; window . location . href = "https://creaturechess.com" ; } , 100 ) ; } ;