Liking cljdoc? Tell your friends :D

hyper.datastar

The Datastar-expression boundary type.

RawExpr wraps a finished Datastar/JS expression string (e.g. the @post(...) an h/action produces). It exists so the same value can be used in two contexts without the caller choosing between them:

  • as a hiccup attribute value — it renders like the string it wraps, escaped for the HTML attribute context (via Chassis);
  • spliced inside h/expr — it contributes its raw JS, not a quoted JS string literal (via the DatastarExpr protocol).

Signals implement DatastarExpr too (yielding their $ref), so both ride the same splice path; anything that does not implement it falls back to a JavaScript literal.

The Datastar-expression boundary type.

`RawExpr` wraps a finished Datastar/JS expression string (e.g. the
`@post(...)` an `h/action` produces).  It exists so the same value can be
used in two contexts without the caller choosing between them:

- as a hiccup attribute value — it renders like the string it wraps,
  escaped for the HTML attribute context (via Chassis);
- spliced inside `h/expr` — it contributes its raw JS, not a quoted JS
  string literal (via the `DatastarExpr` protocol).

Signals implement `DatastarExpr` too (yielding their `$ref`), so both ride
the same splice path; anything that does not implement it falls back to a
JavaScript literal.
raw docstring

datastar-expr?clj

(datastar-expr? x)

True when x renders as a raw Datastar expression (implements DatastarExpr).

True when x renders as a raw Datastar expression (implements DatastarExpr).
sourceraw docstring

DatastarExprcljprotocol

-datastar-jsclj

(-datastar-js x)

The raw Datastar/JS expression source for x, embeddable verbatim in a compiled expression.

The raw Datastar/JS expression source for x, embeddable verbatim in a
compiled expression.
source

raw-exprclj

(raw-expr js)

Wrap a finished Datastar expression string as a RawExpr. Idempotent.

Wrap a finished Datastar expression string as a RawExpr.  Idempotent.
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