mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-21 15:24:09 +00:00
22 lines
537 B
Vue
22 lines
537 B
Vue
<script setup lang="ts">
|
|
import { useSettingStore } from '@/stores/settingStore'
|
|
import { onMounted, onUnmounted } from 'vue'
|
|
|
|
const settingStore = useSettingStore()
|
|
const handleBeforeUnload = (event: BeforeUnloadEvent) => {
|
|
if (settingStore.get('Comfy.Window.UnloadConfirmation')) {
|
|
event.preventDefault()
|
|
return true
|
|
}
|
|
return undefined
|
|
}
|
|
|
|
onMounted(() => {
|
|
window.addEventListener('beforeunload', handleBeforeUnload)
|
|
})
|
|
|
|
onUnmounted(() => {
|
|
window.removeEventListener('beforeunload', handleBeforeUnload)
|
|
})
|
|
</script>
|