mirror of
https://github.com/unraid/api.git
synced 2026-01-06 16:49:49 -06:00
15 lines
534 B
TypeScript
15 lines
534 B
TypeScript
export const preventClose = (e: { preventDefault: () => void; returnValue: string; }) => {
|
|
e.preventDefault();
|
|
// eslint-disable-next-line no-param-reassign
|
|
e.returnValue = '';
|
|
// eslint-disable-next-line no-alert
|
|
alert('Closing this pop-up window while actions are being preformed may lead to unintended errors.');
|
|
};
|
|
|
|
export const addPreventClose = () => {
|
|
window.addEventListener('beforeunload', preventClose);
|
|
};
|
|
|
|
export const removePreventClose = () => {
|
|
window.removeEventListener('beforeunload', preventClose);
|
|
}; |