AtlatestRenderedmarkdown
Readme

sigil-web-client

Client-side WASM UI framework for 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.

(sigil web client) is the browser-side counterpart to the server-side sigil-web framework. The two are orthogonal: this library imports only sigil-wasm-dom and shares no code with the server-side modules.

Usage

(import (sigil web client))

;; Look up a DOM root by selector
(define root (web-client-root "#app"))

;; Mount a view: SXML, or a nullary procedure returning SXML
(web-client-mount root (lambda () `(div "Hello, world!")))

;; Update the mounted view in place
(web-client-update root (lambda () `(div "Updated!")))

;; Clear a root
(web-client-clear root)

Exports

  • web-client-root — look up a DOM root node by selector
  • web-client-root? — validate a root node handle
  • web-client-render — render a view (an SXML value, or a nullary procedure returning one)
  • web-client-mount — mount a view into a root
  • web-client-update — update a mounted view in place
  • web-client-clear — clear a root
  • web-client-reset! — reset retained client state

Building

This is a browser/WASM library. Build it into a web application with the web config:

sigil deps install
sigil build --config web

License

BSD-3-Clause