package virtual_dom

  1. Overview
  2. Docs

Source file ui_event_intf.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
open! Core_kernel

module type Handler = sig
  module Action : sig
    type t
  end

  val handle : Action.t -> unit
end

module type S = sig
  type action
  type t = private ..
  type t += C : action -> t

  val inject : action -> t
end

module type Event = sig
  module type Handler = Handler
  module type S = S

  type t = ..
  type t += Ignore | Many of t list

  module Define (Handler : Handler) :
    S with type action := Handler.Action.t and type t := t

  module Expert : sig
    (** [handle t] looks up the [Handler.handle] function in the table of [Define]d
        functions, unwraps the [Event.t] back into its underlying [Action.t], and applies
        the two.  This is only intended for internal use by this library, specifically by
        the attribute code. *)
    val handle : t -> unit

    val handlers : (t -> unit) Int.Table.t
  end
end
OCaml

Innovation. Community. Security.