diff --git a/tooling/api/src/dialog.ts b/tooling/api/src/dialog.ts index 3308a727f..58c9f5527 100644 --- a/tooling/api/src/dialog.ts +++ b/tooling/api/src/dialog.ts @@ -247,8 +247,8 @@ async function ask( * @example * ```typescript * import { confirm } from '@tauri-apps/api/dialog'; - * const confirm = await confirm('Are you sure?', 'Tauri'); - * const confirm2 = await confirm('This action cannot be reverted. Are you sure?', { title: 'Tauri', type: 'warning' }); + * const confirmed = await confirm('Are you sure?', 'Tauri'); + * const confirmed2 = await confirm('This action cannot be reverted. Are you sure?', { title: 'Tauri', type: 'warning' }); * ``` * * @param {string} message The message to show. diff --git a/tooling/api/src/window.ts b/tooling/api/src/window.ts index 22dc587c5..77e76db15 100644 --- a/tooling/api/src/window.ts +++ b/tooling/api/src/window.ts @@ -53,10 +53,10 @@ * * Events can be listened using `appWindow.listen`: * ```typescript - * import { appWindow } from '@tauri-apps/api/window' - * appWindow.listen('tauri://move', ({ event, payload }) => { - * const { x, y } = payload // payload here is a `PhysicalPosition` - * }) + * import { appWindow } from "@tauri-apps/api/window" + * appWindow.listen("tauri://move", ({ event, payload }) => { + * const { x, y } = payload; // payload here is a `PhysicalPosition` + * }); * ``` * * Window-specific events emitted by the backend: @@ -78,6 +78,16 @@ * #### 'tauri://close-requested' * Emitted when the user requests the window to be closed. * If a listener is registered for this event, Tauri won't close the window so you must call `appWindow.close()` manually. + * ```typescript + * import { appWindow } from "@tauri-apps/api/window"; + * import { confirm } from '@tauri-apps/api/dialog'; + * appWindow.listen("tauri://close-requested", async ({ event, payload }) => { + * const confirmed = await confirm('Are you sure?'); + * if (confirmed) { + * await appWindow.close(); + * } + * }); + * ``` * * #### 'tauri://focus' * Emitted when the window gains focus.