Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Visual Viewport API #137

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Webapi/Dom/Webapi__Dom__VisualViewport.res
Original file line number Diff line number Diff line change
@@ -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
})
3 changes: 3 additions & 0 deletions src/Webapi/Dom/Webapi__Dom__Window.res
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Webapi/Webapi__Dom.res
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down