Compare commits

...

2 commits
v0.1.2 ... main

Author SHA1 Message Date
grngxd
c95bafd34f forgot navigate 2025-06-27 15:26:32 +01:00
grngxd
a3791b599b make fn optional in app.Run 2025-06-27 15:23:51 +01:00
4 changed files with 43 additions and 5 deletions

View file

@ -9,7 +9,7 @@ Build modern, cross-platform desktop apps in HTML + Go from one codebase. It use
- ⚡**Fast development**: Use *ANY* web framework for your UI. Tiramisu handles all the magic of making it work, for you.
## Installation
`go install git.iwakura.rip/grng/tiramisu`
`go get -u git.iwakura.rip/grng/tiramisu`
## Example
@ -23,7 +23,7 @@ import (
func main() {
// create the webview instance
app := tiramisu.New(tiramisu.Options{
app := tiramisu.New(tiramisu.TiramisuOptions{
Title: "Tiramisu Example",
Width: 800,
Height: 600,

View file

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<h1>hello tiramisu!</h1>
</body>
</html>

24
examples/minimal/main.go Normal file
View file

@ -0,0 +1,24 @@
package main
import (
_ "embed"
t "git.iwakura.rip/grng/tiramisu"
webview "github.com/webview/webview_go"
)
//go:embed index.html
var html string
func main() {
app := t.New(t.TiramisuOptions{
Debug: true,
Width: 800,
Height: 600,
Title: "Tiramisu",
Hints: webview.HintFixed,
})
app.HTML(html)
app.Run()
}

View file

@ -40,14 +40,16 @@ func New(o TiramisuOptions) *Tiramisu {
return t
}
func (t *Tiramisu) Run(fn func()) {
func (t *Tiramisu) Run(fns ...func()) {
defer t.w.Destroy()
t.w.Dispatch(func() {
t.loadJSRuntime()
t.loadGoRuntime()
if fn != nil {
fn()
for _, fn := range fns {
if fn != nil {
fn()
}
}
})
t.w.Run()
@ -95,6 +97,12 @@ func (t *Tiramisu) HTML(html string) {
t.loadGoRuntime()
}
func (t *Tiramisu) Navigate(url string) {
t.w.Navigate(url)
t.loadJSRuntime()
t.loadGoRuntime()
}
//go:embed runtime/out/*
var runtimeFS embed.FS