diff --git a/src/Webapi/Dom/Webapi__Dom__VisualViewport.res b/src/Webapi/Dom/Webapi__Dom__VisualViewport.res new file mode 100644 index 0000000..23dcb3f --- /dev/null +++ b/src/Webapi/Dom/Webapi__Dom__VisualViewport.res @@ -0,0 +1,15 @@ +/// Support for https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport + +type t + +@get external height: t => int = "height" +@get external width: t => int = "width" +@get external scale: t => float = "scale" +@get external offsetLeft: t => int = "offsetLeft" +@get external offsetTop: t => int = "offsetTop" +@get external pageLeft: t => int = "pageLeft" +@get external pageTop: t => int = "pageTop" + +include Webapi__Dom__EventTarget.Impl({ + type t = t +}) diff --git a/src/Webapi/Dom/Webapi__Dom__Window.res b/src/Webapi/Dom/Webapi__Dom__Window.res index 02e510a..82dfaa6 100644 --- a/src/Webapi/Dom/Webapi__Dom__Window.res +++ b/src/Webapi/Dom/Webapi__Dom__Window.res @@ -146,6 +146,9 @@ module Impl = ( @set external setOnLoad: (t_window, unit => unit) => unit = "onload" /* use addEventListener instead? */ + + /* VisualViewport API */ + @get external visualViewport: t_window => Webapi__Dom__VisualViewport.t = "visualViewport" } type t = Dom.window diff --git a/src/Webapi/Webapi__Dom.res b/src/Webapi/Webapi__Dom.res index 3f95a65..33fde08 100644 --- a/src/Webapi/Webapi__Dom.res +++ b/src/Webapi/Webapi__Dom.res @@ -77,6 +77,7 @@ module TransitionEvent = Webapi__Dom__TransitionEvent module TreeWalker = Webapi__Dom__TreeWalker module UiEvent = Webapi__Dom__UiEvent module ValidityState = Webapi__Dom__ValidityState +module VisualViewport = Webapi__Dom__VisualViewport module WebGlContextEvent = Webapi__Dom__WebGlContextEvent module WheelEvent = Webapi__Dom__WheelEvent module Window = Webapi__Dom__Window