TheSpyder/rescript-webapi

[Dom.History.scrollRestoration] Incorrect binding

Closed this issue · 2 comments

https://developer.mozilla.org/ko/docs/Web/API/History/scrollRestoration

window.history.scrollRestoration = 'manual';

It seems to be an incorrect binding to scroll Restoration. This requires a string as an argument, not a boulen.

Webapi___Dom___Histroy.res

[@bs.set] external setScrollRestoration : (t, bool) => unit = "scrollRestoration"; /* experimental */

=>

[@bs.set] external setScrollRestoration : (t, string) => unit = "scrollRestoration"; /* experimental */

Oh good catch. I wonder if the API changed before it was finalised.

Rather than string, we can make it a polymorphic variant so it only accepts the two valid strings auto and manual.

Released as 0.5.0