Files
api/web/composables/preventClose.ts
Eli Bosley ad6b6589db feat: convert to pnpm monorepo (#1137)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced enhanced project management scripts for building, testing,
and deploying the monorepo.
- Added an automated testing pipeline for improved reliability of the
Libvirt functionality.
- Provided a new plugin installation script that ensures thorough
cleanup during removal.

- **Improvements**
- Updated container mappings and dependency configurations for more
stable and efficient operations.
- Refined web application settings and build commands for smoother
performance.
- Streamlined continuous integration workflows with optimized caching
and dependency management.
  - Updated allowed origins in configuration for enhanced security.

- **Chores/Refactor**
- Removed outdated configuration files to simplify maintenance and
enhance consistency.
- Enhanced event listener management in the web application for better
error handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-02-19 13:41:23 -05:00

14 lines
452 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);
};