Brew lifecycle
Brew runs a fixed sequence of lifecycle hooks on mount and on every update. Hooks are ordinary methods found by name—they are not callable from the browser.
First mount
Section titled “First mount”Order on the first render:
- Assign matching mount/params onto properties
boot()- Interface-mixin
boot…/initialize… mount(...)(and mixinmount…)booted()- Render (
rendering→ HTML →rendered)
mount receives tag attributes / Brew.mount params (and can take container-resolved trailing args).
class Counter : Component() { var count = 0
fun mount(start: Int = 0) { count = start }
fun boot() { // runs on mount and on every subsequent request }}public class Counter extends Component { public int count = 0;
public void mount(int start) { count = start; }
public void boot() { // runs on mount and on every subsequent request }}Subsequent requests
Section titled “Subsequent requests”On POST /brew/update, Brew restores state from the snapshot, then:
boot/ mixin boot /initialize…hydrate/hydrateFoobooted- Property updates →
updating/updatingFoo/ nested variants, thenupdated… - Action calls
dehydrate/dehydrateFoo- Render (unless skipped)
Property hooks
Section titled “Property hooks”| Hook | When |
|---|---|
updating(path, value) |
Before any property write |
updated(path, value) |
After any property write |
updatingFoo / updatedFoo |
For property foo |
| Nested | updatedFoo($value, $key) style for foo.bar paths |
fun updatedCount(value: Int) { // count just changed}
fun updating(path: String, value: Any?) { // any path, e.g. "todos.0.title"}Render hooks
Section titled “Render hooks”fun rendering(view: BrewView, data: MutableMap<String, Any?>) { data["extra"] = true}
fun rendered(view: BrewView, html: String) { // inspect or log final HTML}Exceptions
Section titled “Exceptions”fun exception(e: Throwable, stopPropagation: () -> Unit) { if (e is IllegalStateException) stopPropagation()}Interface mixins
Section titled “Interface mixins”When your component implements interfaces, Brew also looks for mixin-style hooks such as bootWithX, mountWithX, hydrateWithX, updatingWithX (interface simple name appended). Use them to share behaviour across component families without inheritance.
Skip render
Section titled “Skip render”fun touch() { skipRender() // or @Renderless on the method}- Properties — what hooks observe
- Actions — what runs between hydrate and dehydrate
- Testing — assert lifecycle outcomes