Skip to content
Tauri
Releases

updater

Customize the auto updater flow.

This package is also accessible with window.__TAURI__.updater when build.withGlobalTauri in tauri.conf.json is set to true.

Interfaces

UpdateManifest

Since

1.0.0

Properties

PropertyType
bodystring
datestring
versionstring

UpdateResult

Since

1.0.0

Properties

PropertyType
manifest?UpdateManifest
shouldUpdateboolean

UpdateStatusResult

Since

1.0.0

Properties

PropertyType
error?string
statusUpdateStatus

Type Aliases

UpdateStatus

UpdateStatus: 'PENDING' | 'ERROR' | 'DONE' | 'UPTODATE';

Since

1.0.0

Source: updater.ts:18

Functions

checkUpdate()

checkUpdate(): Promise< UpdateResult >

Checks if an update is available.

Example

import { checkUpdate } from '@tauri-apps/api/updater';
const update = await checkUpdate();
// now run installUpdate() if needed

Since

1.0.0

Returns

Promise< UpdateResult >

Promise resolving to the update status.

Source: updater.ts:146


installUpdate()

installUpdate(): Promise< void >

Install the update if there’s one available.

Example

import { checkUpdate, installUpdate } from '@tauri-apps/api/updater';
const update = await checkUpdate();
if (update.shouldUpdate) {
console.log(
`Installing update ${update.manifest?.version}, ${update.manifest?.date}, ${update.manifest.body}`
);
await installUpdate();
}

Since

1.0.0

Returns

Promise< void >

A promise indicating the success or failure of the operation.

Source: updater.ts:87


onUpdaterEvent()

onUpdaterEvent(handler): Promise< UnlistenFn >

Listen to an updater event.

Example

import { onUpdaterEvent } from '@tauri-apps/api/updater';
const unlisten = await onUpdaterEvent(({ error, status }) => {
console.log('Updater event', error, status);
});
// you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
unlisten();

Since

1.0.2

Parameters

ParameterType
handler(status) => void

Returns

Promise< UnlistenFn >

A promise resolving to a function to unlisten to the event. Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.

Source: updater.ts:63


© 2024 Tauri Contributors. CC-BY / MIT