diff --git a/examples/bind/main.go b/examples/bind/main.go
index b70e66b..9a301ba 100644
--- a/examples/bind/main.go
+++ b/examples/bind/main.go
@@ -2,17 +2,16 @@ package main
import webview "github.com/webview/webview_go"
-const html = `
-
+const html = `
You tapped 0 time(s).
-`
+ const incrementBtn = document.getElementById("increment");
+ const counter = document.getElementById("count");
+ incrementBtn.addEventListener("click", async () => {
+ const result = await window.increment()
+ counter.textContent = result.count;
+ });
+`
type IncrementResult struct {
Count uint `json:"count"`
@@ -26,7 +25,7 @@ func main() {
w.SetSize(480, 320, webview.HintNone)
// A binding that increments a value and immediately returns the new value.
- w.Bind("Increment", func() IncrementResult {
+ w.Bind("increment", func() IncrementResult {
count++
return IncrementResult{Count: count}
})