From 5aa1498ab7008100666d17a8f814a0b9d525157c Mon Sep 17 00:00:00 2001 From: Hugo Nijhuis Date: Fri, 9 Jan 2026 16:44:59 +0100 Subject: [PATCH] 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 --- examples/hello/main.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/hello/main.go diff --git a/examples/hello/main.go b/examples/hello/main.go new file mode 100644 index 0000000..cf6366b --- /dev/null +++ b/examples/hello/main.go @@ -0,0 +1,32 @@ +//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 {} +}