TheSpyder / rescript-webapi

ReScript bindings to the DOM and other Web APIs
http://tinymce.github.io/rescript-webapi/api/Webapi/
Other
149 stars 36 forks source link

[Dom.History.scrollRestoration] Incorrect binding #86

Closed 2Paradise closed 2 years ago

2Paradise commented 2 years ago

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.

WebapiDomHistroy.res

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

=>

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

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.

TheSpyder commented 2 years ago

Released as 0.5.0