Hi friends, is there a resource over the internet ...
# kobweb
s
Hi friends, is there a resource over the internet that guides us how to port JS libraries to be used with Kotlin/JS? Preferably in Kobweb? I want to port the Video.js library for Kobweb but haven't a clue how to approach it.
r
https://dev.to/petuska/js-in-kotlinjs-c4g A bit old, but probably still the best you can find.
thank you color 1
d
As for resources, there are official docs (that admittedly could be better): https://kotlinlang.org/docs/js-interop.html
It usually ends up easier than I expect but lots of trial and error at first. Here's my bindings for reveal.js: https://github.com/bitspittle/droidcon-sf-24/tree/main/site/src/jsMain/kotlin/dev/bitspittle/droidconSf24/bindings/revealjs
s
Great, the GitHub link is quite helpful! Thank you 🙌🏼
d
Robert has some impressive bindings for a project called Tabulator in his kilua framework repository as well: https://github.com/rjaros/kilua/blob/f794fd9b6b8641dc059fbbb35a658fbafac124de/modules/kilua-tabulator/src/commonMain/kotlin/dev/kilua/externals/TabulatorJs.kt
👏 1
I really like what Robert does there because he creates an idiomatic Kotlin object that wraps his JS bindings. You can't always get a great Kotlin API out of some of the crazy JavaScript APIs out there.
So final example, I was teaching myself Kotlin interop by wrapping just a subset of firebase APIs that I needed: https://github.com/bitspittle/firebase-kotlin-bindings
Lots more examples in there as well
thank you color 1