package async_js
A small library that provide Async support for JavaScript platforms
Install
Dune Dependency
Authors
Maintainers
Sources
v0.17.0.tar.gz
sha256=6c8898b69bd5fc0c36d0bbcf5a1a5a2cb0b5deb88504cdaeb532c50b50ac1703
doc/src/async_js.async_test/async_js_test.ml.html
Source file async_js_test.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 25 26 27 28 29 30 31 32 33
module Expect_test_config = struct open Async_kernel module IO = Deferred open Js_of_ocaml external loop_while : (unit -> bool Js.t) Js.callback -> unit = "loop_while" let is_in_browser = Js.Optdef.test (Obj.magic Dom_html.document : _ Js.Optdef.t) let run = if is_in_browser then (fun f -> Async_js.init (); don't_wait_for (let%map.Deferred () = f () in Bonsai_test_handle_garbage_collector.garbage_collect ())) else fun f -> let result = Monitor.try_with f in loop_while (Js.wrap_callback (fun () -> Async_kernel_scheduler.Expert.run_cycles_until_no_jobs_remain (); Js.bool (not (Deferred.is_determined result)))); Bonsai_test_handle_garbage_collector.garbage_collect (); match Deferred.peek result with | Some (Ok result) -> result | Some (Error exn) -> raise exn | None -> assert false ;; let sanitize s = s let upon_unreleasable_issue = Expect_test_config.upon_unreleasable_issue end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>