Files
fn_registry/functions/infra/wails_emit_event.md
T
egutierrez 47fac22230 chore: auto-commit (799 archivos)
- .claude/CLAUDE.md
- .claude/commands/subagentes.md
- .claude/rules/INDEX.md
- .mcp.json
- bash/functions/cybersecurity/analyze_dns.md
- bash/functions/cybersecurity/audit_http_headers.md
- bash/functions/cybersecurity/audit_ssh_config.md
- bash/functions/cybersecurity/check_firewall.md
- bash/functions/cybersecurity/detect_suspicious_users.md
- bash/functions/cybersecurity/encrypt_file.md
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 00:28:20 +02:00

44 lines
1.4 KiB
Markdown

---
name: wails_emit_event
kind: function
lang: go
domain: infra
version: "1.0.0"
purity: impure
signature: "WailsEmitEvent(ctx context.Context, eventName string, data interface{})"
description: "Emite eventos tipados de Go al frontend con timestamp automático. Incluye WailsEmitJSON para serialización explícita."
tags: [wails, event, emit, ipc, realtime, infra, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [context, encoding/json, fmt, time, github.com/wailsapp/wails/v2/pkg/runtime]
params:
- name: ctx
desc: "context de Wails"
- name: eventName
desc: "nombre del evento a emitir (ej: price:update)"
- name: data
desc: "datos a serializar y enviar al frontend"
output: "void (sin valor de retorno, efecto es emitir el evento)"
tested: false
tests: []
test_file_path: ""
file_path: "functions/infra/wails_emit_event.go"
---
## Ejemplo
```go
// Emitir evento tipado
WailsEmitEvent(ctx, "price:update", PriceData{Symbol: "BTC", Price: 67500.0})
// El frontend lo recibe con useWailsEvent:
// useWailsEvent({ eventName: 'price:update', onEvent: (data) => ... })
```
## Notas
El evento llega al frontend como WailsEventPayload con `type`, `data` y `timestamp`. Complementa `use_wails_event` del lado TS. Requiere la dependencia `github.com/wailsapp/wails/v2` en el proyecto destino.