Skip to main content

Module quit

Module quit 

Source
Expand description

Opt-in quit drain.

By default the shell quits at once: Quit marks the app exiting, saves window state, stops the engine and exits. A host that has work to flush first (a mail outbox, an unsaved draft) opts in with crate::ShellBuilder::quit_drain. A quit request then does not exit; it emits rightkit-shell://quit-requested to the renderer, prevents the exit, and waits for the renderer to call rk_shell_finish_quit. The host never trusts the renderer to answer: after a bound (DEFAULT_QUIT_DRAIN_BOUND unless the host sets one, never above MAX_QUIT_DRAIN_BOUND) the app exits anyway.

@rightkit/tauri-shell drains its handlers for 10 s by default, so the 15 s default host bound leaves room for the renderer’s own timeout to fire first and report.

QuitGate is the whole decision and has no Tauri dependency, so the order of events is tested without an event loop; lifecycle only maps RunEvent::ExitRequested and the tray Quit item onto it.

Structs§

QuitGate
The quit decision. One per app, in ShellState.

Enums§

QuitStep
What a quit request should do.

Constants§

DEFAULT_QUIT_DRAIN_BOUND
The host-side bound after which the app exits even if the renderer never calls finish.
MAX_QUIT_DRAIN_BOUND
The longest bound a host may configure; larger values are clamped. An unbounded drain would let a hung renderer keep a quit-requested app alive forever.