pub async fn emit<T: Serialize>(event: &str, payload: &T) -> Result<(), Error>Expand description
Emits an event to the backend.
ยงExample
use tauri_api::event::emit;
use serde::Serialize;
#[derive(Serialize)]
struct Payload {
logged_in: bool,
token: String
}
emit("frontend-loaded", &Payload { logged_in: true, token: "authToken" }).await;@param event Event name. Must include only alphanumeric characters, -, /, : and _.