Skip to main content

Crate tauri_plugin_hotswap

Crate tauri_plugin_hotswap 

Source
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§

DownloadProgress
Payload emitted on hotswap://download-progress events.
HotswapAssets
Custom Assets implementation that checks the filesystem first, then falls back to the embedded assets from the binary.
HotswapBuilder
Builder for advanced usage with a custom resolver.
HotswapConfig
Configuration that can be specified in tauri.conf.json under plugins.hotswap, or passed programmatically.
LifecycleEvent
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§

HotswapPlugin
Plugin instance type returned by initialization helpers.