Romaric Tanguy BANGA
04/02/2021, 8:32 AMAlexey Artemiev
04/03/2021, 6:27 PMnanoid
.
I have followed this piece of docs: https://kotlinlang.org/docs/js-modules.html#apply-jsmodule-to-packages
My `nanoid.kt`:
@file:JsModule("nanoid")
@file:JsNonModule
package nanoid
external fun nanoid(): String
Then I import nanoid.nanoid
and call nanoid()
function from module.Romaric Tanguy BANGA
04/04/2021, 6:14 AMimplementation(npm("materialize-css", "~1.0.0"))
I created materialbox.kt
@file:JsModule("materialize-css")
@file:JsNonModule
package materialbox
external fun materialbox(): String
in my component
import materialbox.materialbox
-----
materialbox() // message error: is not a function
jq("document").ready(fun(){
jq(".materialboxed").materialbox() // message error: is not a function
})
But I have the same error message.
-----------Nicodemus Ojwee
04/06/2021, 6:07 PMexternal val M: dynamic
Where M is i think an object provided by materialize css which can be used in your code as follows to call whatever method from it.
val elems = document.querySelector(".sidenav")
val instances = M.Sidenav.init(elems) {}
OR calling that method you are trying to call like.
var elems = document.querySelectorAll(".materialboxed");
var instances = M.Materialbox.init(elems, options);
NOTE the last code above is in Kotlin not Javascript.
And if you want to use jquery i think Kotlin has a wrapper for it too.
For more you can check out the documentation for materialize css using link below.
https://materializecss.com/media.htmlRomaric Tanguy BANGA
04/08/2021, 4:44 AM@file:JsModule("materialize-css")
@file:JsNonModule
external val M: dynamic
and I use in my PokemonList.kt
val elems = document.querySelectorAll(".materialboxed")
val instances = M.Materialbox.init(elems) {}
I have an other error message: Cannot read property 'Materialbox' of undefined
have I correctly import materialize-css package ? and my build.gradle.kts is correct ?
but when I use Mat.kt
@JsModule("materialize-css")
@JsNonModule
external val M: dynamic
I have no error but media effect is not apply