import document from 'document' ; document . location . replace ( 'another.view' ) . then ( ( ) => { } ) ; document . location . assign ( 'another.view' ) . then ( ( ) => { } ) ; document . addEventListener ( 'beforeunload' , ( evt ) => { } ) ; document . addEventListener ( 'unload' , ( evt ) => { } ) ;