aboutsummaryrefslogtreecommitdiff
path: root/elements
diff options
context:
space:
mode:
Diffstat (limited to 'elements')
-rwxr-xr-xelements/input.ml29
-rwxr-xr-xelements/prop.ml15
2 files changed, 32 insertions, 12 deletions
diff --git a/elements/input.ml b/elements/input.ml
index 790b15d..935f34a 100755
--- a/elements/input.ml
+++ b/elements/input.ml
@@ -3,18 +3,23 @@ open Brr_note
open Note
(** Create a slider element, and a signal with the value *)
-let slider ~at =
- let slider =
- El.input ~at () in
+let slider
+ : at:Brr.At.t list -> Brr.El.t * float S.t
- let event =
- Evr.on_el
- Ev.input (fun _ ->
- let raw_value = El.prop El.Prop.value slider in
- Jstr.to_int raw_value)
- slider
- |> S.hold (Jstr.to_int (El.prop El.Prop.value slider))
- in
- slider, event
+ = fun ~at ->
+ let slider =
+ El.input ~at () in
+
+ let init_value = (Jstr.to_float (El.prop El.Prop.value slider)) in
+
+ let event =
+ Evr.on_el
+ Ev.input (fun _ ->
+ let raw_value = El.prop El.Prop.value slider in
+ Jstr.to_float raw_value)
+ slider
+ |> S.hold init_value
+ in
+ slider, event
diff --git a/elements/prop.ml b/elements/prop.ml
new file mode 100755
index 0000000..715adec
--- /dev/null
+++ b/elements/prop.ml
@@ -0,0 +1,15 @@
+open Brr
+
+include El.Prop
+
+let offsetWidth
+ : int t
+ = El.Prop.int (Jstr.v "offsetWidth")
+
+let offsetHeight
+ : int t
+ = El.Prop.int (Jstr.v "offsetHeight")
+
+let outerHTML
+ : Jstr.t t
+ = El.Prop.jstr (Jstr.v "outerHTML")