You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creates a two-way binding from a signal to the "value" of an HTML "input" element. Can be placed on any HTML element on which data can be input or choices
231
-
selected (e.g. `input`, `textarea`, `select`, `checkbox` and `radio` elements, as well as web components. (Although not necessary, you can find the `switch` statement in the
229
+
selected (e.g. `input`, `textarea`, `select`, `checkbox` and `radio` elements, as well as web components. Although not necessary, you can find the `switch` statement in the
232
230
[source](https://github.com/starfederation/datastar/blob/main/library/src/plugins/attributes/bind.ts) to see how signals are translated).
233
231
The signal will be created if it does not already exist. And the type of the signal is preserved during binding; if an element's value changes,
234
232
the signal value is automatically converted to match the original (see the [documentation](https://data-star.dev/reference/attributes#data-bind) for an example.)
Events and triggers result in [Datastar expressions](https://data-star.dev/guide/datastar_expressions) being executed. This can result in signal changes and other expressions being run.
286
284
Example: clicking a button to send a request or an element scrolling into view.
Attaches an event listener to an element, executing a [Datastar expression](https://data-star.dev/guide/datastar_expressions) whenever the event is triggered.
Runs an expression when the element is loaded into the DOM. **Important:** when patching elements, `ElementPatchMode.Replace` the [Datastar expression](https://data-star.dev/guide/datastar_expressions)
338
-
will be fired a second time, but will not with `ElementPatchMode.Outer`.
You may have noticed in the sample code that the `$` is used in some places, but not others. At first, it might be
490
-
confusing when a `$` is required, but it really isn't all that complicated when you think of it as either being a signal path or an expression.
491
+
confusing when a `$` is required, but it really isn't all that complicated when you think of it as either being a signal path or not.
491
492
492
493
The `$` symbol is a shorthand to get the value of the signal (e.g. `$count` -> `count.value`), so when the `$` is elided, you are referring to the signal directly.
493
494
[`Ds.bind signalPath`](#dsbind--data-bind) is two-way binding to the signal, so it requires the signal path, no `$`.
@@ -627,15 +628,16 @@ are mirrored with a function with `sse` as their prefix instead of `of`.
627
628
628
629
```fsharp
629
630
let handleStream = (fun ctx -> task {
630
-
do! Response.sseStartResponse ctx
631
+
do! Response.sseStartResponse ctx // make sure this is called first; sends the appropriate headers
631
632
632
633
let mutable counter = 0
633
634
634
-
while true do // all Datastar methods (unless requested otherwise) will throw on ctx.RequestAborted
635
+
while true do // all Datastar methods will throw on ctx.RequestAborted
0 commit comments