whoami7 - Manager
:
/
home
/
topsuzmw
/
public_html
/
wp-content
/
plugins
/
extendify
/
src
/
Launch
/
hooks
/
Upload File:
files >> /home/topsuzmw/public_html/wp-content/plugins/extendify/src/Launch/hooks/useWarnOnLeave.js
import { useEffect } from '@wordpress/element'; export const useWarnOnLeave = (enabled = true) => { // Display warning alert if user tries to exit useEffect(() => { if (!enabled) return; const handleUnload = (event) => { event.preventDefault(); return (event.returnValue = ''); }; const opts = { capture: true }; window.addEventListener('beforeunload', handleUnload, opts); return () => { window.removeEventListener('beforeunload', handleUnload, opts); }; }, [enabled]); };
Copyright ©2021 || Defacer Indonesia