Function tauri::api::dialog::ask

source ·
pub fn ask<R: Runtime, F: FnOnce(bool) + Send + 'static>(
    parent_window: Option<&Window<R>>,
    title: impl AsRef<str>,
    message: impl AsRef<str>,
    f: F
)
Available on desktop and crate feature dialog only.
Expand description

Displays a non-blocking dialog with a message and an optional title with a “yes” and a “no” button.

This is not a blocking operation, and should be used when running on the main thread to avoid deadlocks with the event loop.

Examples

use tauri::api::dialog::ask;
ask(Some(&window), "Tauri", "Is Tauri awesome?", |answer| {
  // do something with `answer`
});