tauri_skill
- Python
13
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill bobmatnyc/claude-mpm-skills --skill tauri- metadata.json641 B
- SKILL.md14.6 KB
Overview
This skill provides advanced Tauri event patterns for reliable bidirectional communication, streaming data, multi-window messaging, and custom event handling. It packages practical Rust and TypeScript patterns—typed payloads, streaming, buffering, broadcasting, and listener management—so you can build responsive desktop apps with robust event flows. The focus is on predictable, performant messaging between backend and frontend windows.
How this skill works
The skill demonstrates emitting events from Rust backend to frontend windows and listening in TypeScript, using serde::Serialize for typed payloads and tagged unions for complex events. It covers streaming patterns (real-time and buffered), multi-window broadcasts and targeted messaging via AppHandle, frontend→backend events, and listener utilities like one-time listeners, queues, and React hooks. Error handling, throttling, batching, and safe emission helpers ensure stability and performance.
When to use it
- Notify frontend about backend progress (downloads, processing, sensor reads).
- Stream high-frequency data to UI with throttling or batching (logs, telemetry).
- Relay messages between windows or broadcast global state changes.
- Accept custom frontend events and forward them to backend listeners.
- Manage listeners in React or long-running queues to avoid memory leaks.
Best practices
- Always clean up listeners (call unlisten or stop hooks) to prevent memory leaks.
- Type event payloads in Rust (Serialize) and define TypeScript interfaces for safety.
- Use structured/tagged unions for multi-type events to simplify handling on the frontend.
- Throttle or batch high-frequency emissions to avoid overwhelming the UI or IPC.
- Use once() for single-shot signals (initialization/completion) and queue patterns for ordered processing.
Example use cases
- Download manager: emit download-started, download-progress (typed), and download-complete events to update UI and speed indicators.
- Live sensor monitor: stream sensor-reading events at intervals with a React hook and keep only the latest N readings.
- Log viewer: buffered stream_logs implementation that sends log-batch events to display large files without flooding the frontend.
- Multi-window settings sync: relay_to_settings command forwards changes from main window to settings window via backend.
- Global notifications: broadcast_message to emit alerts to all open windows concurrently.
FAQ
Store the UnlistenFn returned by listen/once and call it in component cleanup or when stopping a queue; prefer useEffect cleanup in React.
When should I batch vs throttle events?
Batch when individual events are small but numerous and can be processed in groups (logs, items). Throttle when you need timely updates but can skip intermediate values (UI updates, metrics).