Async
Work declared now, applied later: the capability a component that calls out is built with.
async { work } runs work on its own virtual thread and posts the transition it returns through the page's mailbox — the topic-delivery path, so it is serialized with everything else, coalesced under load, and dropped without noise if the page has closed by the time it lands. work is ordinary blocking direct-style code: an outbound call through io.eezo.http.client.Http, a transact block, both.
The capability arrives by constructor, through Live.mount(request, async => new Weather(async)), so Component's three methods stay exactly as they are; Init extends this, so init can start a load and return a loading state. The page responds instantly and the data patches in. render must not call it: render runs per event, and work started there is work started per keystroke.
get and post are apply pre-composed with the HTTP client, shaped so the reaction is a total function over Reply's four arms: the compiler itself asks what happens when credentials die (design/live.md M6).
Attributes
- Source
- Component.scala
- Graph
-
- Supertypes
- Known subtypes
-
class Init[S]