|
|
@@ -91,7 +91,7 @@ Before an HTTP request is sent, if one or more slot snapshots's `transmit_after`
|
|
|
|
|
|
# Javascript API
|
|
|
|
|
|
-The Javascript API provides access to the state and actions via the global `statum` object. It automatically handles pre-flight requests, headers, and executing directives from the server.
|
|
|
+The Javascript API provides access to the state and actions via the global `statum` object. It automatically handles pre-flight requests, headers, and executing directives from the server. Note that the Javascript library will also automatically make a request to the Statum Entrypoint URL on page load to get the initial states in order to fill out the page template.
|
|
|
|
|
|
## Managing State
|
|
|
|
|
|
@@ -123,10 +123,14 @@ It is fired whenever a state of the specified type is set or cleared.
|
|
|
|
|
|
# HTML API
|
|
|
|
|
|
-The Javascript library also has some functionality inspired by HTMX using attributes prefixed with `stm-`. Ususally their values refer to something along the JSON object path of the current `statum.state()`.
|
|
|
+The Javascript library also has some functionality inspired by HTMX using attributes prefixed with `stm-`. Ususally their values refer to something along the JSON object path of the current `statum.state()`. The template is re-evaluated each time the state changes.
|
|
|
|
|
|
The following attributes are supported:
|
|
|
|
|
|
+## URL Overrides
|
|
|
+
|
|
|
+The attribute `stm-entrypoint` can be used *only* on the `<body>` tag, to override the default entrypoint url of `/_statum/entrypoint`. Same goes for the `stm-slots` attribute, which can be used to override the default slot post url of `/_statum/slots`.
|
|
|
+
|
|
|
## Text binding
|
|
|
|
|
|
The attribute `stm-text` binds the element's `innerText` to the specified state value, e.g. `<span stm-text="typeName.label">`.
|