-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add Façade Types to Support ResizeObserver #694
Add Façade Types to Support ResizeObserver #694
Conversation
Thank you very much for the PR! To answer your questions:
Our current policy is to accept standardized/standards-track APIs, regardless of their browser support. So feel free to add it :) https://github.com/scala-js/scala-js-dom/blob/main/CONTRIBUTING.md#facades
I think this is a question for @sjrd: could we do something like this and expect it to work, or something else? trait FooReadOnly {
def baz: Int = js.native
}
trait Foo extends FooReadOnly {
def baz_=(x: Int): Unit = js.native
} |
Yes, that works. |
I'm assuming the My guess is DomRect needs to loose the setters on In Chrome: I tried mutating
|
Thanks for investigating!
Source-breaking, and that's fine consider it wasn't working anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Took a first pass through with pointers about our current idioms/code style, thanks!
6c4ca27
to
d84ef7d
Compare
Co-authored-by: Arman Bilge <armanbilge@gmail.com>
…-js-dom into cs/add-resize-observer
@armanbilge I think I addressed all your suggestions? Sorry I made a bit of a mess of the commits. I can squash when this is ready to go. |
Co-authored-by: Arman Bilge <armanbilge@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Apologies, I did notice one last small thing :)
No need for a squash commit, personally I find keeping "messy" history to be valuable :)
Thanks for all of your work on this!
No problem at all. Happy to give back where I can 😄 . We use this library (and Scala.js as a whole) extensively since our platform/product is pure Scala. Appreciate what you all have done here! |
Mozilla Docs : https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver
Similar to MutationObserver
I wasn't sure about adding ResizeObserverEntry.devicePixelContentBoxSize, since as of now it isn't supported by Safari. I decided to leave out, but I would be happy to add it into this PR.
I also added DOMRectReadOnly, which seems a bit out of place in this PR but a few of the interfaces require that type. I'm also a bit concerned about adding it in this state due to the already implemented DOMRect. In the Mozilla docs it indicates that DOMRect extends the DOMRectReadOnly interface, but that doesn't really transfer well to Scala (vars vs defs). Looking for some guidance on approach here.