package bonsai
A library for building dynamic webapps, using Js_of_ocaml
Install
Dune Dependency
Authors
Maintainers
Sources
v0.15.1.tar.gz
sha256=0c4a714146073f421f1a6179561f836b45d8dc012c743207d3481ea63bef74bf
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)"
>