Liking cljdoc? Tell your friends :D

hyper.context

Request context and dynamic vars for hyper applications.

Lives in a low-level namespace so that both render.clj and core.clj can reference these vars without circular dependencies.

Request context and dynamic vars for hyper applications.

Lives in a low-level namespace so that both render.clj and core.clj
can reference these vars without circular dependencies.
raw docstring

*action-idx*clj

source

*action-name*clj

source

*declared-signals*clj

source

*region-path*clj

source

*registered-action-ids*clj

source

*registered-subview-ids*clj

source

*render-guard*clj

source

*request*clj

source

*signals*clj

source

*state-overlay*clj

source

apply-opsclj

(apply-ops state ops)

Replay an ordered op-log against a state value, returning the new state. :update applies its fn to the current value (composing with concurrent writes), :reset overwrites the path, :cas writes only when the value still equals the expected old. Pure — runs inside flush-overlay!'s swap!, so op fns must be side-effect free, as with clojure.core/swap!.

Replay an ordered op-log against a state value, returning the new state.
:update applies its fn to the current value (composing with concurrent
writes), :reset overwrites the path, :cas writes only when the value
still equals the expected old.  Pure — runs inside flush-overlay!'s
swap!, so op fns must be side-effect free, as with clojure.core/swap!.
sourceraw docstring

current-overlayclj

(current-overlay)

Return the bound state overlay, but only when the current thread created it. An overlay seen on any other thread is a conveyed binding (future / send-off / fiber spawned inside a render or batch) — treat it as absent so cursor reads/writes hit the live app-state directly.

Future extension: a sanctioned bound-fn-style opt-in could let work on another thread deliberately participate in the owner's overlay by adopting its :owner; until then, ownership is strictly single-thread.

Return the bound state overlay, but only when the current thread created
it.  An overlay seen on any other thread is a conveyed binding (future /
send-off / fiber spawned inside a render or batch) — treat it as absent
so cursor reads/writes hit the live app-state directly.

Future extension: a sanctioned `bound-fn`-style opt-in could let work
on another thread deliberately participate in the owner's overlay by
adopting its :owner; until then, ownership is strictly single-thread.
sourceraw docstring

flush-overlay!clj

(flush-overlay! app-state*)

Replay the current overlay's op-log onto the live atom in a single swap!. No-op when nothing was recorded, or the calling thread doesn't own the overlay.

Replay the current overlay's op-log onto the live atom in a single swap!.
No-op when nothing was recorded, or the calling thread doesn't own the
overlay.
sourceraw docstring

guard-discard!clj

(guard-discard!)

form-2/3 resolution: the page handler call was a legal setup/construction phase, so drop any buffered effects and switch the guard to :active so the render fn itself is judged.

form-2/3 resolution: the page handler call was a legal setup/construction
phase, so drop any buffered effects and switch the guard to :active so the
render fn itself is judged.
sourceraw docstring

guard-effect!clj

(guard-effect! kind)
(guard-effect! kind detail)

Report an effect (cursor mutation, watch!, …) to the active render guard. kind is a keyword (e.g. :cursor-mutation, :watch); detail is an optional string/value for the message. No-op when no guard is bound or the guard level is :off. In :deferred mode the event is buffered; in :active mode it is emitted immediately (warn) or throws (error).

Report an effect (cursor mutation, watch!, …) to the active render guard.
`kind` is a keyword (e.g. :cursor-mutation, :watch); `detail` is an
optional string/value for the message.  No-op when no guard is bound or
the guard level is :off.  In :deferred mode the event is buffered; in
:active mode it is emitted immediately (warn) or throws (error).
sourceraw docstring

guard-flush-and-activate!clj

(guard-flush-and-activate!)

form-1 resolution: the page handler call WAS the render body, so emit any buffered effects (warn, or throw on the first when :error) and switch the guard to :active for lazy hiccup realization.

form-1 resolution: the page handler call WAS the render body, so emit any
buffered effects (warn, or throw on the first when :error) and switch the
guard to :active for lazy hiccup realization.
sourceraw docstring

make-guardclj

(make-guard level)

Create a fresh render-guard atom at the given level (:warn, :error, or :off). Starts in :deferred mode.

Create a fresh render-guard atom at the given level (:warn, :error, or
:off).  Starts in :deferred mode.
sourceraw docstring

partial-render-bindingsclj

(partial-render-bindings req)

Build the thread-binding map for a partial (reactive component) render. No state overlay — reads/writes go directly to the live atom.

Build the thread-binding map for a partial (reactive component) render.
No state overlay — reads/writes go directly to the live atom.
sourceraw docstring

render-bindingsclj

(render-bindings req app-state*)

Build the thread-binding map for a full render context. Includes a state overlay snapshot so cursor reads/writes are isolated. Returns a map suitable for push-thread-bindings.

Build the thread-binding map for a full render context.
Includes a state overlay snapshot so cursor reads/writes are isolated.
Returns a map suitable for `push-thread-bindings`.
sourceraw docstring

require-context!clj

(require-context! caller-name)

Extract and validate the request context from request. Throws if called outside a request context or if required keys are missing. Returns a map with :session-id, :tab-id, :app-state*, and :router.

Extract and validate the request context from *request*.
Throws if called outside a request context or if required keys are missing.
Returns a map with :session-id, :tab-id, :app-state*, and :router.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close