Function tauri_wasm::api::event::emit
source · pub async fn emit<T: Serialize>(event: &str, payload: &T) -> Result<()>Expand description
Emits an event to the backend.
§Example
use tauri_wasm::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 _.