Skip to main content

Events

nque uses Tauri events for two asynchronous flows: PDF import progress and live display synchronization. Event names are defined in src/lib/events.ts on the frontend and emitted from Rust.

Import progress​

Event nameDirectionPayload
ocr-import-progressbackend → UI{ phase, current, total }

Emitted by import_pdf_show as the pipeline advances. phase is one of detect, extract, render, ocr, or classify; current/total are 1-based page counters. The file-actions hook listens for this event and pushes updates into the import slice, which drives the progress dialog.

Live display synchronization​

Event nameDirectionPayload
cue-firedmain → displays{ cueText: string | null }
request-active-cuedisplay → mainnone
respond-active-cuemain → displays{ cueText: string | null }

Flow:

  1. When the operator fires a cue, perform mode emits cue-fired with the cue text (or null).
  2. Each live display listens for cue-fired and renders the payload.
  3. On mount, a display emits request-active-cue.
  4. Perform mode listens for that and re-emits cue-fired with the current active cue, so a display opened mid-show is immediately correct.
export const EVENTS = {
CUE_FIRED: "cue-fired",
REQUEST_ACTIVE_CUE: "request-active-cue",
RESPOND_ACTIVE_CUE: "respond-active-cue",
} as const;
note

RESPOND_ACTIVE_CUE is reserved for an explicit response channel; the current implementation answers request-active-cue by re-emitting cue-fired.

See Live display for the user-facing behavior.