import { useEffect } from 'react';
export const useBeforeUnload = (beforeunload) => {
    useEffect(() => {
        const handleBeforeUnload = (event) => {
            if (beforeunload) {
                event.preventDefault();
            }
        };
        window.addEventListener('beforeunload', handleBeforeUnload);
        return () => {
            window.removeEventListener('beforeunload', handleBeforeUnload);
        };
    }, [beforeunload]);
};
//# sourceMappingURL=UseBeforeUnload.js.map