Another question about integrating Three.js. I fou...
# javascript
a
Another question about integrating Three.js. I found a very useful JS object in the library, but the problem is that it is not present in the final
min.js
module. For JS people recommend to do it like that: https://stackoverflow.com/questions/46362627/use-convexgeometry-in-npm-version-of-three. Is it possible to do it in kotlin-js?
s
You can import declarations from JavaScript modules using
@JsModule
annotation [https://kotlinlang.org/docs/reference/js-modules.html#jsmodule-annotation] I believe in your case it would look like:
Copy code
@JsModule("three/examples/js/geometries")
external object ConvexGeometry
a
Thanks. I will try it.
t
@altavir Which declarations you use for Kotlin/JS?
a
@turansky What do you mean by declarations?
t
I mean Kotlin declarations
a
Still not sure, what do you mean. A recommended by @Svyatoslav Kuzmich [JB] I try to use
@JsModule
for module declarations. In some cases I use
require
, but I still have a little understanding about how they interfere.
t
s
@JsModule
does
require
under the hood. It just helps you to use static types with declarations coming from JS modules.
a
@turansky I've worked and updated https://github.com/markaren/three.kt, but I am open to suggestions