import { app } from "../app" ; let navigationBlockedMessage = "Are you sure to leave current page?" ; let navigationBlockRemover = undefined ; export function isIEBrowser ( ) { return navigator . userAgent . indexOf ( "MSIE" ) > 0 || navigator . userAgent . indexOf ( "Trident/" ) > 0 ; } export function setNavigationBlockedMessage ( message ) { if ( message ) { navigationBlockedMessage = message ; } } export function blockNavigation ( ) { window . onbeforeunload = ( ) => navigationBlockedMessage ; navigationBlockRemover = app . browserHistory . block ( ( transition ) => { if ( window . confirm ( navigationBlockedMessage ) ) { setTimeout ( allowNavigation , 0 ) ; transition . retry ( ) ; } } ) ; } export function allowNavigation ( ) { window . onbeforeunload = null ; navigationBlockRemover ?. ( ) ; navigationBlockRemover = undefined ; }