package inquire
An OCaml library to create beautiful interactive CLIs
Install
Dune Dependency
Authors
Maintainers
Sources
inquire-0.2.1.tbz
sha256=0b88d89e24d4cbc0560a7c8d8ec51388990e1b27f24685029997afa52a7c720f
sha512=8b62860a8d15e41528a404a6f1b9968c3d79755607b5ea319af2e3e45516e672a785361d278279910928db4054e1800e87bcee0210ff3eabfb330713b368c827
doc/src/inquire.lambda-term/lTerm_widget_callbacks.ml.html
Source file lTerm_widget_callbacks.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
(* * lTerm_widget_callbacks.ml * --------------- * Copyright : (c) 2011, Jeremie Dimino <jeremie@dimino.org> * Licence : BSD3 * * This file is a part of Lambda-Term. *) let section = Lwt_log.Section.make "lambda-term(widget_callbacks)" (* +-----------------------------------------------------------------+ | Callbacks | +-----------------------------------------------------------------+ *) type switch = { mutable switch_state : (unit -> unit) list option } type 'a callbacks = 'a LTerm_dlist.t let create () = LTerm_dlist.create () let register switch_opt seq f = match switch_opt with | None -> ignore (LTerm_dlist.add_l f seq) | Some switch -> match switch.switch_state with | Some l -> let node = LTerm_dlist.add_l f seq in switch.switch_state <- Some ((fun () -> LTerm_dlist.remove node) :: l) | None -> () let stop switch = match switch.switch_state with | Some l -> switch.switch_state <- None; List.iter (fun f -> f ()) l | None -> () let exec_callbacks seq x = LTerm_dlist.iter_l (fun f -> try f x with exn -> ignore (Lwt_log.error ~section ~exn "callback failed with")) seq let exec_filters seq x = LTerm_dlist.fold_l (fun f acc -> if acc then true else begin try f x with exn -> ignore (Lwt_log.error ~section ~exn "filter failed with"); false end) seq false
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>