Skip to main content

Module SkyEvent

Module SkyEvent 

Source
Expand description

§Sky Event Registry - single source of truth for Mountain → Sky/Wind events

Mountain emits Tauri events on sky://… URIs to notify the webview of state changes that don’t originate from a Wind-initiated invoke call. Historically each emit site used a free-text string literal and each Wind listener matched against its own free-text string - drift was invisible until runtime (the listener simply never fired).

SkyEvent is the enumerated registry. Mountain callers dispatch on the variant; the wire string is produced by AsStr() and parsed by FromStr. The matching TypeScript const object lives at Element/Wind/Source/IPC/SkyEvent.ts - kept in sync by convention, same protocol as the Channel registry.

§Adding a new event

  1. Add the variant here AND in Element/Wind/Source/IPC/SkyEvent.ts.
  2. Emit from Mountain: ApplicationHandle.emit(SkyEvent::TerminalData.AsStr(), Payload).
  3. Subscribe from Wind: IPCService.events(SkyEvent.TerminalData).

§Why a declarative macro?

Same rationale as Channel: the variant → wire-string mapping is pure data. DefineSkyEvents! expands it into enum body + AsStr + All + FromStr in one pass so adding an event is a single-line change that compilers can’t forget.

Macros§

DefineSkyEvents 🔒

Enums§

SkyEvent
Enumerated Mountain → Sky/Wind event identifiers.