Skip to main content

init

Function init 

Source
pub fn init<R: Runtime, F: FnMut(&AppHandle<R>, Vec<String>, String) + Send + Sync + 'static>(
    f: F,
) -> TauriPlugin<R>
Expand description

Initializes the plugin, calling f whenever a second instance of the app is started.

This is a shortcut for Builder::new with Builder::callback set to f, then Builder::build. Use Builder directly if you need to set a custom Builder::dbus_id.

f is called with the app handle, the second instance’s command line arguments (as collected by std::env::args_os, so the first element is the executable path) and its current working directory. Arguments and the working directory that are not valid Unicode have their invalid parts replaced by U+FFFD. If the deep-link feature is enabled, the arguments are first forwarded to tauri-plugin-deep-link before f runs.

The second instance never reaches tauri::Builder::run: it hands its arguments and working directory off to the first instance and exits immediately.