package bonsai
A library for building dynamic webapps, using Js_of_ocaml
Install
Dune Dependency
Authors
Maintainers
Sources
bonsai-v0.16.0.tar.gz
sha256=1d68aab713659951eba5b85f21d6f9382e0efa8579a02c3be65d9071c6e86303
doc/src/bonsai.web_ui_element_size_hooks/import.ml.html
Source file import.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
open! Core open Js_of_ocaml let cancel_animation_frame id = Dom_html.window##cancelAnimationFrame id let request_animation_frame f = Dom_html.window##requestAnimationFrame (Js.wrap_callback f) ;; let add_event_listener ?(use_capture = false) ?(prevent_default = false) element event ~f = Dom_html.addEventListener element event (Dom.full_handler (fun element event -> f element event; Js.bool prevent_default)) (Js.bool use_capture) ;; let set_width element x = element##.style##.width := Js.string (sprintf "%fpx" x) let set_height element x = element##.style##.height := Js.string (sprintf "%fpx" x) let reset_width element = element##.style##.width := Js.string "" let reset_height element = element##.style##.height := Js.string ""
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>