AtlatestRepositorysigil-web-client
sigil-web-client / treeREADME.md
1
# sigil-web-client3
Client-side WASM UI framework for [Sigil](https://codeberg.org/sigil/sigil). A react-like rendering layer for browser applications compiled to WebAssembly: it renders Sigil SXML into the browser DOM and keeps application code independent of the underlying WASM DOM bridge.5
`(sigil web client)` is the browser-side counterpart to the server-side [sigil-web](https://codeberg.org/sigil/sigil-web) framework. The two are orthogonal: this library imports only `sigil-wasm-dom` and shares no code with the server-side modules.7
## Usage9
```scheme10
(import (sigil web client))12
;; Look up a DOM root by selector13
(define root (web-client-root "#app"))15
;; Mount a view: SXML, or a nullary procedure returning SXML16
(web-client-mount root (lambda () `(div "Hello, world!")))18
;; Update the mounted view in place19
(web-client-update root (lambda () `(div "Updated!")))21
;; Clear a root22
(web-client-clear root)23
```25
### Exports27
- `web-client-root` — look up a DOM root node by selector28
- `web-client-root?` — validate a root node handle29
- `web-client-render` — render a view (an SXML value, or a nullary procedure returning one)30
- `web-client-mount` — mount a view into a root31
- `web-client-update` — update a mounted view in place32
- `web-client-clear` — clear a root33
- `web-client-reset!` — reset retained client state35
## Building37
This is a browser/WASM library. Build it into a web application with the `web` config:39
```sh40
sigil deps install41
sigil build --config web42
```44
## License46
BSD-3-Clause