Add async event handling example with mutable state

This commit is contained in:
2026-04-04 22:01:24 +03:00
parent 236ed15dd9
commit 5c2461ab11
3 changed files with 80 additions and 10 deletions
+14 -8
View File
@@ -17,14 +17,20 @@ make
Then serve locally and open in your browser:
```sh
python3 -m http.server 9994 --directory examples/basics
python3 -m http.server 9994 --directory examples
```
Open `http://localhost:9994/basics/index.html` for the full example index, or go directly:
| URL | What it does |
|-----|-------------|
| `http://localhost:9994/hello.html` | Alerts "Hei maailma!" on load |
| `http://localhost:9994/factorial.html` | Prompts for n, displays n! |
| `http://localhost:9994/fibonacci.html` | Prompts for n, displays fib(n) |
| `http://localhost:9994/basics/hello.html` | Alerts "Hei maailma!" on load |
| `http://localhost:9994/basics/factorial.html` | Prompts for n, displays n! |
| `http://localhost:9994/basics/fibonacci.html` | Prompts for n, displays fib(n) |
| `http://localhost:9994/data-structures/lista.html` | List sorted ascending and descending |
| `http://localhost:9994/data-structures/vektori.html` | Custom class, Euclidean length of [3,4] = 5 |
| `http://localhost:9994/strings/merkkijono.html` | String length, concat, trim, split |
| `http://localhost:9994/async/nappi.html` | Click handlers, mutable counter |
## What is Tampio?
@@ -46,10 +52,10 @@ See [`docs/cheatsheet.md`](docs/cheatsheet.md) for a map of Finnish grammatical
| Directory | Contents |
|-----------|----------|
| `examples/basics/` | Hello world, factorial, Fibonacci |
| `examples/data-structures/` | Lists, maps |
| `examples/strings/` | String manipulation |
| `examples/async/` | Promise / async usage |
| `examples/program/` | A small complete program |
| `examples/data-structures/` | Built-in list operations, custom class |
| `examples/strings/` | String length, concat, trim, split |
| `examples/async/` | DOM click handlers, mutable state |
| `examples/program/` | A small complete program (coming soon) |
## Local Setup (without Docker)