Skip to content

Commit 2412ed1

Browse files
committed
Go - Add Raw Binary Example
1 parent ef0b11f commit 2412ed1

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

docs/go.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,19 +508,18 @@ See [set_context](#set_context) for a full example.
508508
---
509509
### get_arg
510510

511-
Parse the first JavaScript argument into a Go type. Supports `string`, `int`, `float64`, `bool`, and any JSON-decodable struct.
511+
Parse the first JavaScript argument into a Go type. Supports `string`, `int`, `float64`, `bool`, `[]byte`, and any JSON-decodable struct.
512512

513513
```go
514514
webui.Bind[string](win, "greet", func(e webui.Event) string {
515515
name, err := webui.GetArg[string](e)
516-
if err != nil {
517-
return "error: " + err.Error()
518-
}
519-
return "Hello, " + name + "!"
516+
age, err := webui.GetArg[int](e)
517+
num, err := webui.GetArg[float64](e)
518+
status, err := webui.GetArg[bool](e)
519+
data, err := webui.GetArg[[]byte](e)
520520
})
521521
```
522522

523-
524523
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
525524
---
526525
### get_arg_at

0 commit comments

Comments
 (0)