package fmlib_js

  1. Overview
  2. Docs

Source file event_target.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
open Js_of_ocaml

type js_string = Js.js_string Js.t

class type event_target =
object
    method addEventListener:    js_string -> ('a -> unit) -> unit Js.meth
    method removeEventListener: js_string -> ('a -> unit) -> unit Js.meth
end


type t = event_target Js.t

let add (name: string) (handler: Event.t -> unit) (tgt: t): unit =
    tgt##addEventListener (Js.string name) handler

let remove (name: string) (handler: Event.t -> unit) (tgt: t): unit =
    tgt##removeEventListener (Js.string name) handler
OCaml

Innovation. Community. Security.