feat: agregar método SendCommand al CDP client

Agrega método conveniente SendCommand() que retorna map directamente.

Simplifica llamadas CDP que necesitan resultado como map en lugar de struct.

Antes: Execute(ctx, method, params, &result)
Ahora: SendCommand(ctx, method, params) retorna map

Archivo: pkg/cdp/client.go
This commit is contained in:
Developer
2026-03-25 00:48:46 +01:00
parent 3a0250f7fb
commit 1b9dc96556
+9
View File
@@ -204,6 +204,15 @@ func (c *Client) Execute(ctx context.Context, method string, params interface{},
}
}
// SendCommand envía un comando CDP y retorna el resultado como map
func (c *Client) SendCommand(ctx context.Context, method string, params interface{}) (map[string]interface{}, error) {
var result map[string]interface{}
if err := c.Execute(ctx, method, params, &result); err != nil {
return nil, err
}
return result, nil
}
// On registra un handler para un evento específico.
func (c *Client) On(event string, handler EventHandler) {
c.eventMu.Lock()