-
Notifications
You must be signed in to change notification settings - Fork 162
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
scrollIntoView missing newer options #414
Comments
By PRs from users who notice that something's not up to date. ScalablyTyped focuses on applications by design. It's not designed for libraries that everyone depends on, such as the DOM. |
I'll just mention in passing that the Typescript DOM definitions are 1) up to date for every TS release, 2) very detailed, 3) tagged by which standard (es5, esnext, etc) things were defined in. ST takes all this and massages it into Scala.js through a series of rewrites. If there is interest nothing in theory stops us from writing a custom conversion script which would "sync" all/some of it here. In the mean time it's easy to copy/paste and adapt code as necessary @nafg :) |
@nafg would you mind making a PR? would be much appreciated!! :) |
Sounds very appealing ... maybe one day :) |
Sorry I never made a PR. For now here is the code I use in my project. Maybe it will be easy for a maintainer to adapt it into the codebase. Otherwise maybe I can do it in the next few days (but I may need a reminder). object scrollIntoView {
trait Options extends js.Object {
val block : js.UndefOr[String] = js.undefined
val inline : js.UndefOr[String] = js.undefined
val behavior: js.UndefOr[String] = js.undefined
}
def blockNearest = new Options {
override val block = "nearest"
}
def apply(elem: dom.Element)(options: Options): Unit =
elem.asInstanceOf[js.Dynamic].scrollIntoView(options).asInstanceOf[Unit]
} The obvious change that needs to be made is replacing the object apply method and its implementation with changing the signature of the existing method. I guess I'm just going through utility code in my application codebase. I haven't looked up the DOM docs so it might be missing other things. |
scala-js-dom/src/main/scala/org/scalajs/dom/raw/lib.scala
Line 814 in 35fed55
From lib.dom.d.ts:
In particular, it would be great not to have to write
More broadly how is this repo kept in sync with browser APIs? Can ScalablyTyped help somehow?
The text was updated successfully, but these errors were encountered: