Expand description
Async boot lifecycle for Tauri plugins.
Tauri 2’s setup() closure is synchronous and runs on the macOS main
thread with no Tokio reactor. This module provides BootBuilder and
BootContext to run async initialization (event stores, projections,
command buses) correctly — creating a dedicated Tokio runtime, blocking
until boot completes, and emitting progress events to the frontend.
§Example
ⓘ
allframe_tauri::builder(router)
.on_boot(2, |ctx| async move {
let store = open_store(&ctx.data_dir()?).await
.map_err(|e| BootError::Failed(e.to_string()))?;
ctx.inject_state(store);
ctx.emit_progress("Event store opened");
let registry = init_projections().await
.map_err(|e| BootError::Failed(e.to_string()))?;
ctx.inject_state(registry);
ctx.emit_progress("Projections ready");
Ok(())
})
.build()Structs§
- Boot
Builder - Builder for creating a Tauri plugin with an optional async boot phase.
- Boot
Context - Context passed to the async boot closure.
- Boot
Progress - Progress event payload emitted during boot as
allframe-tauri:boot-progress.
Enums§
- Boot
Error - Errors that can occur during the boot phase.