Skip to content

Commit

Permalink
Apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Sep 22, 2023
1 parent 6de656e commit d65675b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions examples/bind/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ package main

import webview "github.com/webview/webview_go"

const html = `<html style="background: #1B2845; color: #eee;">
<button onclick="increment();">Tap me</button>
const html = `<html>
<button id="increment">Tap me</button>
<div>You tapped <span id="count">0</span> time(s).</div>
<script>
const counter = document.getElementById("count")
async function increment() {
const result = await window.Increment()
const incrementBtn = document.getElementById("increment");
const counter = document.getElementById("count");
incrementBtn.addEventListener("click", async () => {
const result = await window.increment()
counter.textContent = result.count;
}
});
</script>
</html>`

Expand All @@ -26,7 +27,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}
})
Expand Down

0 comments on commit d65675b

Please sign in to comment.