5f4f1f7508
Añade campos params y output al frontmatter YAML de las 506 funciones del registry. Cada parámetro tiene descripción semántica (qué representa, unidades, rango típico) y cada función describe qué produce su output. Permite a agentes razonar sobre cadenas de composición (ej: prices → log_return → sharpe_ratio) sin leer código.
44 lines
1.3 KiB
Markdown
44 lines
1.3 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]
|
|
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.
|