package quickterface
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Quick-to-program app interfaces in OCaml for terminal and web
Install
dune-project
Dependency
Authors
Maintainers
Sources
quickterface-0.1.0.tbz
sha256=8261e3819564fb5d05f1f313e62b73382152591d7a4349ae5b1b08a4fc2469f3
sha512=e739a971bb0e696ab716c168419c59a3d195922d2d1e4963106a845e3442ffa085b05106f36cceeec9b806bf7d6ef2c31e98db04911fbf73c5ac0ce626449d0f
doc/src/quickterface_web_app_backend/app.ml.html
Source file app.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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69open! Core open! Js_of_ocaml open Quickterface.Io type t = { head : Head.t; log : Log.t } let make () = let document = Dom_html.document in let%lwt head = Head.make ~document () in let main_container = Dom_html.createDiv document in (main_container##.className := Class.(to_js_string Main_container)); let log = Log.make ~document ~main_container in Dom.appendChild document##.body main_container; Lwt.return { head; log } let input_text ?prompt t () = Log.input_text ?prompt t.log () let input_integer t () = Log.input_integer t.log () let input_single_selection t = Log.input_single_selection t.log let input_single_selection_string t options = Log.input_single_selection t.log options Fn.id let input_multi_selection t = Log.input_multi_selection t.log let input_multi_selection_string t options = Log.input_multi_selection t.log options Fn.id let input : type settings a. _ -> (settings, a) Input.t -> settings -> unit -> a Lwt.t = fun t -> function | Text -> fun prompt -> input_text ?prompt t | Integer -> fun () -> input_integer t | Single_selection -> fun (options, option_to_string) -> input_single_selection t options option_to_string | Multi_selection -> fun (options, option_to_string) -> input_multi_selection t options option_to_string let output_text ?options t value () = Log.add_output_text ?options t.log ~value () let output_math ?options t value () = Log.add_output_math ?options t.log ~value () let output_title t value () = let%lwt () = Log.add_output_title t.log ~value () in let%lwt () = Head.set_title t.head value () in Lwt.return () let output : type options a. ?options:options -> _ -> (options, a) Output.t -> a -> unit -> unit Lwt.t = fun ?options t -> function | Text -> fun x -> output_text ?options t x | Math -> fun x -> output_math ?options t x | Title -> ( fun x -> match options with | None | Some () -> output_title t x) let with_progress_bar ?label { head = _; log } = Log.with_progress_bar ?label log let console_log_error message () = Console.console##error (Js.string message); Lwt.return ()
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>