package fmlib_js

  1. Overview
  2. Docs

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
open Js_of_ocaml


class type event =
object
    method stopPropagation: unit -> unit Js.meth
    method preventDefault:  unit -> unit Js.meth
end




type t = event Js.t

let value (e: t): Base.Value.t =
    Obj.magic e

let stop_propagation (e: t): unit =
    e##stopPropagation ()

let prevent_default (e: t): unit =
    e##preventDefault ()


let mouse (typ: string) (options: Base.Value.t): t =
    let make: (Js.js_string Js.t -> Base.Value.t -> event Js.t) Js.constr =
        Js.Unsafe.global##._MouseEvent
    in
    new%js make (Js.string typ) options