Async

io.eezo.live.Async
class Async[S]

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
class Object
trait Matchable
class Any
Known subtypes
class Init[S]

Members list

Value members

Concrete methods

def apply(work: => S => S): Unit

Runs work off the page thread; its returned transition applies like a topic message. A work that throws is logged and moves nothing — nobody is blocked on it, so the log line is the whole story.

Runs work off the page thread; its returned transition applies like a topic message. A work that throws is logged and moves nothing — nobody is blocked on it, so the log line is the whole story.

Attributes

Source
Component.scala
def get(url: String, headers: (String, String)*)(react: Reply => S => S): Unit

Attributes

Source
Component.scala
def post(url: String, body: String, contentType: String = ..., headers: (String, String)*)(react: Reply => S => S): Unit

Attributes

Source
Component.scala