Hello, I'm trying to add <https://developer.mozill...
# compose-web
t
Hello, I'm trying to add https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API into our JetPack Compose for Web app. Any idea how to do that will least pain? AFAIK IntersectionObserver is not available via
kotlinx.browser
classes. So should i use
js()
to all the stuff?
o
I think you can try to use
external
modifier https://kotlinlang.org/docs/js-interop.html#external-modifier it's possible to use
js()
anyway. But maybe you would prefer
external
t
Ok, thanks for suggestion. So when i use
external
, I have to map that class and all classes it uses (
IntersectionObserverEntry
and all classes that it uses for its properties). Right?
Wow, it works. I'm amazed how easy it was. Thanks.
K 2
b
Also you can chop off typesafety with dynamic type
So you'd only have to define types for things that you actually use and ignore the rest
t
I found I can do that even with type safety. I mapped only those methods and properties from the class I need for my purposes.
b
I meant cases where you only need the property but not its type hierarchy