make fn optional in app.Run

This commit is contained in:
grngxd 2025-06-27 15:23:51 +01:00
parent 34e396271d
commit a3791b599b
4 changed files with 36 additions and 4 deletions

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()