Macro tauri::generate_handler[][src]

generate_handler!() { /* proc-macro */ }
Expand description

Accepts a list of commands functions. Creates a handler that allows commands to be called from JS with invoke().

Example

use tauri::command;
#[command]
fn command_one() {}
#[command]
fn command_two() {}
fn main() {
  tauri::Builder::default()
    .invoke_handler(tauri::generate_handler![command_one, command_two])
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
}

Stability

The output of this macro is managed internally by Tauri, and should not be accessed directly on normal applications. It may have breaking changes in the future.