Files
fn_registry/frontend/functions/ui/use_wails_event.md
T
egutierrez 87e8f33b01 fix: corregir lang y file_path en frontmatter de funciones existentes
Normaliza lang: typescript → ts en funciones frontend y corrige file_path de functions/infra/ → functions/browser/ en funciones CDP. Actualiza referencias cn_typescript_core → cn_ts_core.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 03:23:20 +02:00

1.6 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path, props, emits, has_state, framework, variant, source_repo, source_license, source_file
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports tested tests test_file_path file_path props emits has_state framework variant source_repo source_license source_file
use_wails_event component ts ui 1.0.0 impure useWailsEvent<T>(opts: UseWailsEventOptions<T>): UseWailsEventResult<T> Hook para suscripción a eventos Go→TS y emisión TS→Go via Wails runtime. Soporta once, maxCallbacks, emit bidireccional.
wails
event
hook
ipc
realtime
component
ui
false
react
false
frontend/functions/ui/use_wails_event.tsx
name type required description
eventName string true Nombre del evento Wails
name type required description
onEvent (data: T) => void false Callback al recibir evento
name type required description
once boolean false Solo escuchar una vez
name type required description
enabled boolean false Habilitar suscripción
onEvent
true react
default
https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/Bl4cksmith/Frontend_Library MIT frontend/src/lib/wails/use-wails-event.tsx

Ejemplo

// Escuchar eventos de Go
const { lastData, eventCount, emit } = useWailsEvent<PriceUpdate>({
  eventName: 'price:update',
  onEvent: (price) => updateChart(price),
})

// Emitir de TS a Go
emit({ symbol: 'BTC', action: 'subscribe' })

Notas

Exporta también useWailsEmit() para emit sin suscripción. Usa window.runtime.EventsOn/Off/Emit del Wails runtime.