https://kotlinlang.org logo
#javascript
Title
# javascript
r

Rafał Kuźmiński

03/14/2024, 3:48 PM
Hello! I am trying to rewrite part of our JS code to Kotlin but I am stuck on IntersectionObserver. When I try to use callback this error occurs: How can I implement IntersectionObserver in Kotlin JS?
a

Artem Kobzar

03/14/2024, 4:00 PM
IntersectionObserverCallback is just an alias to a functional type. So, you can define it as a lambda or an anonymous function.
Copy code
val callback: IntersectionObserverCallback = { entries, observer ->
  TODO()
}
r

Rafał Kuźmiński

03/14/2024, 4:02 PM
Great, thanks!
🫡 3