Skip to content

Commit f96d8d3

Browse files
committed
Add Visual Viewport API
1 parent bc2065b commit f96d8d3

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-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

0 commit comments

Comments
 (0)