Component lifecycle hooks: :start, :stop, :wakeup.
Each hook returns [self' effects] (or just effects, for terse
cleanup hooks). The functions in this namespace fold a hook's
emitted effects through run-effects, returning [conv' fragments]
for the caller.
To keep the dependency direction one-way (kernel requires lifecycle,
not the other way), the kernel's run-effects is passed in as
run-effects-fn. No back-reference from lifecycle to kernel.
Component lifecycle hooks: `:start`, `:stop`, `:wakeup`. Each hook returns `[self' effects]` (or just `effects`, for terse cleanup hooks). The functions in this namespace fold a hook's emitted effects through `run-effects`, returning `[conv' fragments]` for the caller. To keep the dependency direction one-way (kernel requires lifecycle, not the other way), the kernel's `run-effects` is passed in as `run-effects-fn`. No back-reference from lifecycle to kernel.
(coerce-return self result)Normalise whatever a handler or lifecycle hook returned into the
kernel's canonical [self' effects] pair. Accepted shapes:
nil → [self []] ; explicit no-op (cleanup hooks)
<map> → [<map> []] ; state change, no effects
[<map> <v>] → as-is ; the canonical pair
<vec> → [self <vec>] ; effects only, same self
The map and pair cases let :handle return (assoc self :n 1) or
[(s/answer :ok)] directly when one side of the pair would be
ceremony; the original [self' effects] form keeps working.
Normalise whatever a handler or lifecycle hook returned into the
kernel's canonical `[self' effects]` pair. Accepted shapes:
nil → [self []] ; explicit no-op (cleanup hooks)
<map> → [<map> []] ; state change, no effects
[<map> <v>] → as-is ; the canonical pair
<vec> → [self <vec>] ; effects only, same self
The map and pair cases let `:handle` return `(assoc self :n 1)` or
`[(s/answer :ok)]` directly when one side of the pair would be
ceremony; the original `[self' effects]` form keeps working.(run-start-hook run-effects-fn conv iid)Run :start for iid if present, without rendering the instance.
Callers decide which newly-started frame should be rendered.
Run `:start` for `iid` if present, without rendering the instance. Callers decide which newly-started frame should be rendered.
(run-start-hooks run-effects-fn conv iids)Run :start for each iid in order, collecting fragments.
Run `:start` for each iid in order, collecting fragments.
(run-stop-hooks run-effects-fn conv iids)Run :stop for the instance ids, preserving any emitted fragments.
The instances are still present while hooks run; callers remove them
afterwards.
Uses lookup (not lookup!) for the cdef: a component that was
de-registered after the instance was created (hot-reload, test
teardown, shutdown after registry/clear!) simply has no :stop to
run. :start and :wakeup still error loudly on missing cdefs —
the asymmetry is intentional, since stop has nowhere to surface a
late-binding error to.
Run `:stop` for the instance ids, preserving any emitted fragments. The instances are still present while hooks run; callers remove them afterwards. Uses `lookup` (not `lookup!`) for the cdef: a component that was de-registered after the instance was created (hot-reload, test teardown, shutdown after `registry/clear!`) simply has no `:stop` to run. `:start` and `:wakeup` still error loudly on missing cdefs — the asymmetry is intentional, since stop has nowhere to surface a late-binding error to.
(run-wakeup-hooks run-effects-fn conv iids)Run :wakeup for each iid in order, collecting fragments.
Run `:wakeup` for each iid in order, collecting fragments.
(wakeup-frame run-effects-fn conv iid)Run :wakeup for iid, updating the instance before rendering.
Run `:wakeup` for `iid`, updating the instance before rendering.
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 |