Files
iris/examples/hello/main.go
Hugo Nijhuis 5aa1498ab7
All checks were successful
CI / build (pull_request) Successful in 39s
CI / build (push) Successful in 27s
Add hello world example
Minimal Iris application demonstrating:
- Signal creation with NewSignal
- Reactive text rendering with TextFromFunction
- Auto-incrementing counter to show reactivity

Closes #2

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 16:44:59 +01:00

33 lines
507 B
Go

//go:build js && wasm
package main
import (
"fmt"
"time"
"git.flowmade.one/flowmade-one/iris/reactive"
"git.flowmade.one/flowmade-one/iris/ui"
)
func main() {
count := reactive.NewSignal(0)
// Increment count every second to show reactivity
go func() {
for {
time.Sleep(time.Second)
count.Set(count.Get() + 1)
}
}()
view := ui.NewView()
view.Child(ui.TextFromFunction(func() string {
return fmt.Sprintf("Hello, Iris! Count: %d", count.Get())
}))
ui.NewApp(view)
select {}
}