mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
feat(api): add abstractions to updater and window event listeners (#4569)
This commit is contained in:
committed by
GitHub
parent
e29fff2566
commit
b02fc90f45
@@ -22,8 +22,18 @@
|
||||
import { listen } from '@tauri-apps/api/event'
|
||||
import { ask } from '@tauri-apps/api/dialog'
|
||||
|
||||
appWindow.listen('tauri://file-drop', function (event) {
|
||||
onMessage(`File drop: ${event.payload}`)
|
||||
if (appWindow.label !== 'main') {
|
||||
appWindow.onCloseRequested(async (event) => {
|
||||
const confirmed = await confirm('Are you sure?')
|
||||
if (!confirmed) {
|
||||
// user did not confirm closing the window; let's prevent it
|
||||
event.preventDefault()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
appWindow.onFileDropEvent((event) => {
|
||||
onMessage(`File drop: ${JSON.stringify(event.payload)}`)
|
||||
})
|
||||
|
||||
const views = [
|
||||
|
||||
Reference in New Issue
Block a user