Skip to content

Commit 9e8dca8

Browse files
committed
Add Visual Viewport API
1 parent bc2065b commit 9e8dca8

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// Support for https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport
2+
3+
type t
4+
5+
@get external height: t => int = "height"
6+
@get external width: t => int = "width"
7+
@get external scale: t => float = "scale"
8+
@get external offsetLeft: t => int = "offsetLeft"
9+
@get external offsetTop: t => int = "offsetTop"
10+
@get external pageLeft: t => int = "pageLeft"
11+
@get external pageTop: t => int = "pageTop"
12+
13+
include Webapi__Dom__EventTarget.Impl({
14+
type t = t
15+
})

src/Webapi/Dom/Webapi__Dom__Window.res

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ module Impl = (
146146
@set
147147
external setOnLoad: (t_window, unit => unit) => unit =
148148
"onload" /* use addEventListener instead? */
149+
150+
/* VisualViewport API */
151+
@get external visualViewport: t_window => Webapi__Dom__VisualViewport.t = "visualViewport"
149152
}
150153

151154
type t = Dom.window

src/Webapi/Webapi__Dom.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ module TransitionEvent = Webapi__Dom__TransitionEvent
7777
module TreeWalker = Webapi__Dom__TreeWalker
7878
module UiEvent = Webapi__Dom__UiEvent
7979
module ValidityState = Webapi__Dom__ValidityState
80+
module VisualViewport = Webapi__Dom__VisualViewport
8081
module WebGlContextEvent = Webapi__Dom__WebGlContextEvent
8182
module WheelEvent = Webapi__Dom__WheelEvent
8283
module Window = Webapi__Dom__Window

0 commit comments

Comments
 (0)