Skip to content

Commit 276ef2d

Browse files
committed
add scrollToWithOptions to window
1 parent 558c7d5 commit 276ef2d

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

lib/js/tests/Webapi/Dom/Webapi__Dom__Window__test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ window.scrollBy(10.0, -10.0);
7272

7373
window.scrollTo(120.5, 300.3);
7474

75+
window.scrollTo({
76+
left: 1.0,
77+
top: 1.0,
78+
behavior: "smooth"
79+
});
80+
7581
window.stop();
7682

7783
window.onload = (function (param) {

src/Webapi/Dom/Webapi__Dom__Window.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ module Impl = (
130130
@send
131131
external scrollTo: (t_window, float, float) => unit = "" /* experimental, CSSOM View module */
132132
@send external stop: t_window => unit = ""
133+
134+
@send external scrollToWithOptions: (T.t, {"top": float, "left": float, "behavior": string}) => unit = "scrollTo"
133135

134136
@send
135137
external addPopStateEventListener: (

tests/Webapi/Dom/Webapi__Dom__Window__test.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,6 @@ let _ = window->Window.resizeTo(120, 300)
7171
let _ = window->Window.scroll(0.0, 0.0)
7272
let _ = window->Window.scrollBy(10.0, -10.0)
7373
let _ = window->Window.scrollTo(120.5, 300.3)
74+
let _ = window->Window.scrollToWithOptions({ "left": 1.0, "top": 1.0, "behavior": "smooth"})
7475
Window.stop(window)
7576
Window.setOnLoad(window, () => print_endline("load"))

0 commit comments

Comments
 (0)