mirror of
https://github.com/unraid/api.git
synced 2026-01-03 23:19:54 -06:00
14 lines
450 B
TypeScript
14 lines
450 B
TypeScript
export const preventClose = (e: { preventDefault: () => void; returnValue: string; }) => {
|
|
e.preventDefault();
|
|
e.returnValue = '';
|
|
confirm('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);
|
|
};
|