["/nds-connect"
["/:component/:component-id/:event" {:get {:handler ds/handler-connected-component-connect}
:post {:handler ds/handler-connected-component-event}}]]
process-component-event's result no longer carries :request. It keeps its signature and still returns :ctx and :html; it now throws an ex-info with ::timeout after 30 s.(ds/send-event! cid user "tick" {:remaining 4})), and handle an event that can arrive in any state on the machine's own :on (Gotchas).clojure.core.async.flow of two procs, :controller (the state machine) and :view (the render fn), between an :in-chan and an :out-chan. The machine and render fn are resolved once, when the flow is built.taia.ds.datastar.use-cases.process-event (with process-event.controller, .view and .common), the pure rules in domain.ctx and domain.event, and a new adapter, adapters.handlers.request, that turns a Ring request into the flow's message — the use case and the domain see plain data only. pipeline.clj is gone./ds/nds/…) gets a flow of its own: about 200 µs per event against 100 µs for the plain pipeline, with no thread or heap growth (proc loops run on virtual threads).handler-connected-component-event: POST /ds/nds-connect/<component>/<component-id>/<event> runs through the stream's flow and is answered with the render; without an open stream it falls back to the one-shot handler.send-event!: a server event to a connection's flow; its render is pushed down the stream. New connections: who has an open stream, {component-id [user-id …]} — look there when send-event! answers false.start-component-flow!, run-flow-event! and stop-component-flow!: drive a flow headless, e.g. to test a connected component in process.!connections entries are {:sse-gen :flow}; whoever removes an entry (on-close, a stale write, a reconnect) stops its flow.:route :nds-connect-event.live.countdown): a connected component driven by server events, with its article, spec block and e2e spec.(inc!) / (reset!), and send-event! / connections snippets.dev: start! / stop! / restart! touch only the HTTP server, never the nREPL you are connected through; a lazy user ns offers the same; Jetty logs at WARN in development.bb coverage: the unit tests under Cloverage, an HTML report in target/coverage/; bb coverage <ns-prefix> reports only those namespaces.spy/called-once-with?, values written inline, threads one step per line. 114 test blocks, 748 assertions.scripts/component_flow_svg.clj (bb component-flow-gif), and a "What you write" section.send-event! with params, the POST route, and what a server event starts from.home.home, with a controller). There is no page route any more: a GET on /ds/nds/home.home/home/init?example=<name> renders it, and start! returns that URL. layout.clj → components/home/ (the registry lives in the controller).docs/state-machines.md.datastar brick no longer ships example components: adapters.components.counter.* and html-page are gone from the jar. The discovery tests moved to the brick's test dir and define the component they resolve in memory.[] (was ["taia.ds.datastar.adapters.components"], which named nothing). Applications must call set-component-search-paths! at startup — they already had to.logging: the REPL debugging helpers debug, log->, log->> and dbg are gone; levels is private. The interface is trace, trace-when, trace-enabled?, warn, with-context, local-context, flatten-ctx, log-level, set-log-level!, safe-for-log.datastar, state-machines, logging, extensions, renamed under taia.ds.*.datastar.js (v1.0.0-RC.8) and sse-reconnect.js shipped as classpath resources under datastar/js/.examples base + projects/examples: six components (counter, live counter, signup form, wizard, TodoMVC, weather via Open-Meteo) with walkthroughs in docs/examples/ and an in-process test suite; bb dev serves them.bb e2e-test: Playwright suite against the examples app (e2e/), with a console-error guard and a two-user SSE fan-out spec.docs/img/counter-flow.svg, GIF rendered by bb flow-gif).doc/cljdoc.edn; generated docs/api.md (bb api-index).ctx->data-signals, html-response.:patch (the previous :broadcast effect was ignored by the initial-render path, so the example never rendered).Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |