Skip to main content

Module folds

Module folds 

Source
Expand description

UI-6: the folds — a component’s handlers, components/<name>.rhai, run in Rhai: every fn name(state, ev) returns the new state.

One rhai::Engine per component with only call(method, params), navigate(route) and, FRAME-12, the bus’s emit(topic, data) and slots_set(layout, slot, component[, version]) registered — no DOM, no socket, no other component. A topic the component hears (on("topic", "fold"), the tree’s bus) runs its fold with ev.bus = { topic, data }. The props are constants in the scope by name. call is held to the component’s uses: a handler naming a method outside it is refused when the component is compiled (at mount), naming the method; the engine checks it again at the call. FRAME-37: call(method, params, "fold") — the fold a handler of this component, by a literal name, refused at mount otherwise — runs that fold once when the call’s stream ends, with ev = #{ method, params, ok, events, message } (Host::call_then).

Structs§

Folds
A component’s compiled handlers.

Enums§

FoldError
Why handlers did not compile or a fold did not run.

Traits§

Host
What a handler reaches: the engine’s call and navigate.