@eyeauras/workbench-tauri
Optional React bindings for typed Tauri events, runtime detection, subscription readiness, and safe StrictMode cleanup.
Install
npm install @eyeauras/[email protected] @tauri-apps/api react
Quickstart
Requires React >=18 and a Tauri 2 webview. Enable event permissions in your host. Browser-only hosts
can disable subscriptions or supply a listen override for their own transport.
import { useState } from "react";
import { defineTauriEvent, isTauriRuntime, useTauriEvent } from "@eyeauras/workbench-tauri";
const progressEvent = defineTauriEvent<{ percent: number }>("download-progress");
export function DownloadProgress() {
const [percent, setPercent] = useState(0);
useTauriEvent(progressEvent, payload => setPercent(payload.percent), {
enabled: isTauriRuntime(), onError: console.error,
});
return <progress max={100} value={percent} aria-label="Download" />;
}
The descriptor names the event; it does not validate payloads. The hook releases its listener on unmount, including a subscription that resolves later. No WorkbenchProvider, styles or Monaco is needed.
This adapter is standalone and does not pull in the Workbench core. See the EyeAuras UI Workbench repository for architecture and consumer guidance.