Available on crate feature
updater
only.Expand description
The Tauri updater.
The updater is focused on making Tauri’s application updates as safe and transparent as updates to a website.
For a full guide on setting up the updater, see https://tauri.app/v1/guides/distribution/updater.
Check UpdateBuilder
to see how to manually trigger and customize the updater at runtime.
Events
To listen to the updater events, for example to check for error messages, you need to use RunEvent::Updater
in App::run
.
let app = tauri::Builder::default()
// on an actual app, remove the string argument
.build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
.expect("error while building tauri application");
app.run(|_app_handle, event| match event {
tauri::RunEvent::Updater(updater_event) => {
match updater_event {
tauri::UpdaterEvent::UpdateAvailable { body, date, version } => {
println!("update available {} {:?} {}", body, date, version);
}
// Emitted when the download is about to be started.
tauri::UpdaterEvent::Pending => {
println!("update is pending!");
}
tauri::UpdaterEvent::DownloadProgress { chunk_length, content_length } => {
println!("downloaded {} of {:?}", chunk_length, content_length);
}
// Emitted when the download has finished and the update is about to be installed.
tauri::UpdaterEvent::Downloaded => {
println!("update has been downloaded!");
}
// Emitted when the update was installed. You can then ask to restart the app.
tauri::UpdaterEvent::Updated => {
println!("app has been updated");
}
// Emitted when the app already has the latest version installed and an update is not needed.
tauri::UpdaterEvent::AlreadyUpToDate => {
println!("app is already up to date");
}
// Emitted when there is an error with the updater. We suggest to listen to this event even if the default dialog is enabled.
tauri::UpdaterEvent::Error(error) => {
println!("failed to update: {}", error);
}
_ => (),
}
}
_ => {}
});
Structs
Information about a release returned by the remote update server.
An update check builder.
The response of an updater check.
Enums
All errors that can occur while running the updater.
Constants
Check for new updates
The name of the event that is emitted on download progress.
Used to initialize an update should run check-update first (once you received the update available event)
The update has been downloaded.
When you got this status, something went wrong
you can find the error message inside the
error
field.this is the status emitted when the download start
When you receive this status, you should ask the user to restart
Send updater status or error even if dialog is enabled, you should
always listen for this event. It’ll send you the install progress
and any error triggered during update check and install
When you receive this status, this is because the application is running last version
New update available
Functions
Initializes the
UpdateBuilder
using the app configuration.Gets the target string used on the updater.
Type Definitions
Alias for
std::result::Result
using our own Error
.