Skip to main content

builder

Function builder 

Source
pub fn builder<R: Runtime>(router: Router) -> BootBuilder<R>
Expand description

Create a BootBuilder for configuring an async boot phase before the app renders.

§Example

tauri::Builder::default()
    .plugin(
        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("Store ready");
                Ok(())
            })
            .build(),
    )
    .run(tauri::generate_context!())
    .unwrap();