File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,16 @@ package main
22
33import webview "github.com/webview/webview_go"
44
5- const html = `<html style="background: #1B2845; color: #eee;" >
6- <button onclick ="increment(); ">Tap me</button>
5+ const html = `<html>
6+ <button id ="increment">Tap me</button>
77<div>You tapped <span id="count">0</span> time(s).</div>
88<script>
9- const counter = document.getElementById("count")
10- async function increment() {
11- const result = await window.Increment()
9+ const incrementBtn = document.getElementById("increment");
10+ const counter = document.getElementById("count");
11+ incrementBtn.addEventListener("click", async () => {
12+ const result = await window.increment()
1213 counter.textContent = result.count;
13- }
14+ });
1415</script>
1516</html>`
1617
@@ -26,7 +27,7 @@ func main() {
2627 w .SetSize (480 , 320 , webview .HintNone )
2728
2829 // A binding that increments a value and immediately returns the new value.
29- w .Bind ("Increment " , func () IncrementResult {
30+ w .Bind ("increment " , func () IncrementResult {
3031 count ++
3132 return IncrementResult {Count : count }
3233 })
You can’t perform that action at this time.
0 commit comments