package jsoo-react
Bindings to ReactJS for js_of_ocaml, including JSX ppx
Install
Dune Dependency
Authors
Maintainers
Sources
0.1.tar.gz
sha256=93d5751c01016f5aa018b80259df0c65ac12f25152cef1dbcff024ddfc1f07b5
md5=240fd3b58cb002ff7eaa6ddddb7eba87
doc/src/jsoo-react.lib/event.ml.html
Source file event.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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
(* Adapted from reason-react ReactEvent.re, commit 0f73a307 *) type 'a synthetic = Ojs.t module CommonApi = struct include [%js: type tag = Ojs.t type t = Ojs.t val t_of_js : Ojs.t -> t val t_to_js : t -> Ojs.t val bubbles : Ojs.t -> bool [@@js.get "bubbles"] val cancelable : t -> bool [@@js.get "cancelable"] val current_target : t -> Ojs.t [@@js.get "currentTarget"] (* Should return Dom.eventTarget *) val default_prevented : t -> bool [@@js.get "defaultPrevented"] val event_phase : t -> int [@@js.get "eventPhase"] val is_trusted : t -> bool [@@js.get "isTrusted"] val native_event : t -> Ojs.t [@@js.get "nativeEvent"] (* Should return Dom.event *) val prevent_default : t -> unit [@@js.call "preventDefault"] val is_default_prevented : t -> bool [@@js.call "isDefaultPrevented"] val stop_propagation : t -> unit [@@js.call "stopPropagation"] val is_propagation_stopped : t -> bool [@@js.call "isPropagationStopped"] val target : t -> Ojs.t [@@js.get "target"] (* Should return Dom.eventTarget *) val time_stamp : t -> float [@@js.get "timeStamp"] val type_ : t -> string [@@js.get "type"] val persist : t -> unit [@@js.call "persist"]] end module Synthetic = CommonApi (* Cast any event type to the general synthetic type. This is safe, since synthetic is more general *) external to_synthetic_event : 'a synthetic -> Synthetic.t = "%identity" module Clipboard = struct include CommonApi include [%js: val clipboard_data : t -> Ojs.t [@@js.get "clipboardData"]] (* Should return Dom.dataTransfer *) end module Composition = struct include CommonApi include [%js: val data : t -> string [@@js.get "data"]] end module Keyboard = struct include CommonApi include [%js: val alt_key : t -> bool [@@js.get "altKey"] val char_code : t -> int [@@js.get "charCode"] val ctrl_key : t -> bool [@@js.get "ctrlKey"] val get_modifier_state : t -> string -> bool [@@js.call "getModifierState"] val key : t -> string [@@js.get "key"] val key_code : t -> int [@@js.get "keyCode"] val locale : t -> string [@@js.get "locale"] val location : t -> int [@@js.get "location"] val meta_key : t -> bool [@@js.get "metaKey"] val repeat : t -> bool [@@js.get "repeat"] val shift_key : t -> bool [@@js.get "shiftKey"] val which : t -> int [@@js.get "which"]] end module Focus = struct include CommonApi include [%js: val related_target : t -> Ojs.t option [@@js.get "relatedTarget"]] (* Should return Dom.eventTarget *) end module Form = struct include CommonApi end module Mouse = struct include CommonApi include [%js: val alt_key : t -> bool [@@js.get "altKey"] val button : t -> int [@@js.get "button"] val buttons : t -> int [@@js.get "buttons"] val client_x : t -> int [@@js.get "clientX"] val client_y : t -> int [@@js.get "clientY"] val ctrl_key : t -> bool [@@js.get "ctrlKey"] val get_modifier_state : t -> string -> bool [@@js.call "getModifierState"] val meta_key : t -> bool [@@js.get "metaKey"] val page_x : t -> int [@@js.get "pageX"] val page_y : t -> int [@@js.get "pageY"] val related_target : t -> Ojs.t option [@@js.get "relatedTarget"] (* Should return Dom.eventTarget *) val screen_x : t -> int [@@js.get "screenX"] val screen_y : t -> int [@@js.get "screenY"] val shift_key : t -> bool [@@js.get "shiftKey"]] end module Selection = struct include CommonApi end module Touch = struct include CommonApi include [%js: val alt_key : t -> bool [@@js.get "altKey"] val changed_touches : t -> Ojs.t [@@js.get "changedTouches"] (* Should return Dom.touchList *) val ctrl_key : t -> bool [@@js.get "ctrlKey"] val get_modifier_state : t -> string -> bool [@@js.call "getModifierState"] val meta_key : t -> bool [@@js.get "metaKey"] val shift_key : t -> bool [@@js.get "shiftKey"] val target_touches : t -> Ojs.t [@@js.get "targetTouches"] (* Should return Dom.touchList *) val touches : t -> Ojs.t [@@js.get "touches"]] (* Should return Dom.touchList *) end module Pointer = struct include Mouse include [%js: val pointerId : t -> int [@@js.get] val pressure : t -> float [@@js.get] val tangentialPressure : t -> float [@@js.get] val tiltX : t -> float [@@js.get] val tiltY : t -> float [@@js.get] val twist : t -> float [@@js.get] val width : t -> float [@@js.get] val height : t -> float [@@js.get] val pointerType : t -> string [@@js.get] val isPrimary : t -> bool [@@js.get]] end type window = Js_of_ocaml.Dom_html.window module UI = struct external window_of_js : Ojs.t -> Js_of_ocaml.Dom_html.window = "%identity" include CommonApi include [%js: val detail : t -> int [@@js.get "detail"] val view : t -> window [@@js.get "view"]] (* Should return DOMAbstractView/WindowProxy *) end module Wheel = struct include CommonApi include [%js: val delta_mode : t -> int [@@js.get "deltaMode"] val delta_x : t -> float [@@js.get "deltaX"] val delta_y : t -> float [@@js.get "deltaY"] val delta_z : t -> float [@@js.get "deltaZ"]] end module Media = struct include CommonApi end module Image = struct include CommonApi end module Animation = struct include CommonApi include [%js: val animation_name : t -> string [@@js.get "animationName"] val pseudo_element : t -> string [@@js.get "pseudoElement"] val elapsed_time : t -> float [@@js.get "elapsedTime"]] end module Transition = struct include CommonApi include [%js: val property_name : t -> string [@@js.get "propertyName"] val pseudo_element : t -> string [@@js.get "pseudoElement"] val elapsed_time : t -> float [@@js.get "elapsedTime"]] end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>