Skip to content

Commit a873384

Browse files
committed
Dom_html: add window.matchMedia & MediaQueryList
1 parent 059fe7d commit a873384

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

lib/js_of_ocaml/dom_html.ml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,14 @@ and toggleEvent = object
464464
method oldState : js_string t readonly_prop
465465
end
466466

467+
and mediaQueryListEvent = object
468+
inherit event
469+
470+
method matches : js_string t readonly_prop
471+
472+
method media : bool t readonly_prop
473+
end
474+
467475
and dataTransfer = object
468476
method dropEffect : js_string t prop
469477

@@ -2312,6 +2320,16 @@ class type _URL = object
23122320
method revokeObjectURL : js_string t -> unit meth
23132321
end
23142322

2323+
class type mediaQueryList = object
2324+
method media : js_string t prop
2325+
2326+
method matches : bool readonly_prop
2327+
2328+
method onchange : (mediaQueryList t, mediaQueryListEvent t) event_listener prop
2329+
2330+
inherit eventTarget
2331+
end
2332+
23152333
class type window = object
23162334
inherit eventTarget
23172335

@@ -2428,6 +2446,8 @@ class type window = object
24282446
method _URL : _URL t readonly_prop
24292447

24302448
method devicePixelRatio : number_t readonly_prop
2449+
2450+
method matchMedia : js_string t -> mediaQueryList t meth
24312451
end
24322452

24332453
let window : window t = Js.Unsafe.global

lib/js_of_ocaml/dom_html.mli

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,14 @@ and toggleEvent = object
477477
method oldState : js_string t readonly_prop
478478
end
479479

480+
and mediaQueryListEvent = object
481+
inherit event
482+
483+
method matches : js_string t readonly_prop
484+
485+
method media : bool t readonly_prop
486+
end
487+
480488
and dataTransfer = object
481489
method dropEffect : js_string t prop
482490

@@ -2164,6 +2172,16 @@ class type _URL = object
21642172
method revokeObjectURL : js_string t -> unit meth
21652173
end
21662174

2175+
class type mediaQueryList = object
2176+
method media : js_string t prop
2177+
2178+
method matches : bool readonly_prop
2179+
2180+
method onchange : (mediaQueryList t, mediaQueryListEvent t) event_listener prop
2181+
2182+
inherit eventTarget
2183+
end
2184+
21672185
(** Specification of window objects *)
21682186
class type window = object
21692187
inherit eventTarget
@@ -2285,6 +2303,8 @@ class type window = object
22852303
method _URL : _URL t readonly_prop
22862304

22872305
method devicePixelRatio : number_t readonly_prop
2306+
2307+
method matchMedia : js_string t -> mediaQueryList t meth
22882308
end
22892309

22902310
val window : window t

0 commit comments

Comments
 (0)