Expand description
§tauri-plugin-hotswap
Hot-swap frontend assets at runtime without rebuilding the binary.
This Tauri v2 plugin swaps the embedded asset provider at startup via
Context::set_assets(). The WebView keeps loading from tauri://localhost —
the swap is transparent. If no cached bundle is available, embedded assets
are served as usual.
§Quick start
// tauri.conf.json
{
"plugins": {
"hotswap": {
"endpoint": "https://example.com/api/ota/{{current_sequence}}",
"pubkey": "<YOUR_MINISIGN_PUBKEY>"
}
}
}ⓘ
let context = tauri::generate_context!();
let (plugin, context) = tauri_plugin_hotswap::init(context)
.expect("failed to initialize hotswap plugin");
tauri::Builder::default()
.plugin(plugin)
.run(context)
.expect("error running app");Re-exports§
pub use error::Error;pub use manifest::HotswapCheckResult;pub use manifest::HotswapManifest;pub use manifest::HotswapMeta;pub use manifest::HotswapVersionInfo;pub use policy::BinaryCachePolicy;pub use policy::BinaryCachePolicyKind;pub use policy::ConfirmationDecision;pub use policy::ConfirmationPolicy;pub use policy::ConfirmationPolicyKind;pub use policy::RetentionConfig;pub use policy::RetentionPolicy;pub use policy::RollbackPolicy;pub use policy::RollbackPolicyKind;pub use resolver::CheckContext;pub use resolver::HotswapResolver;pub use resolver::HttpResolver;pub use resolver::StaticFileResolver;
Modules§
- error
- Error types returned by the plugin.
- manifest
- Manifest and response types exchanged between client and server.
- policy
- Configurable policy traits for OTA update lifecycle decisions. Configurable policy traits for OTA update lifecycle decisions.
- resolver
- Resolver trait and built-in implementations for update checking.
Structs§
- Download
Progress - Payload emitted on
hotswap://download-progressevents. - Hotswap
Assets - Custom Assets implementation that checks the filesystem first, then falls back to the embedded assets from the binary.
- Hotswap
Builder - Builder for advanced usage with a custom resolver.
- Hotswap
Config - Configuration that can be specified in
tauri.conf.jsonunderplugins.hotswap, or passed programmatically. - Lifecycle
Event - Lifecycle event payload emitted on
hotswap://lifecycle.
Functions§
- init
- Initialize the plugin by reading config from
tauri.conf.json. - init_
with_ config - Initialize with explicit config (no tauri.conf.json needed).
Type Aliases§
- Hotswap
Plugin - Plugin instance type returned by initialization helpers.