jonathan
03/19/2018, 10:50 AMorg.jetbrains.kotlin.frontend
and have "mprogress" as a dependency
.
I've set up this external class:
external class Mprogress(params: Json) {
fun start()
fun end()
fun set(percent: Double)
fun inc()
}
However, when I try to create a new Mprogress object, it says it can't locate Mprogress' JS definition. How can I make sure it's included?gildor
03/20/2018, 3:29 AMjonathan
03/20/2018, 5:31 AM...
kotlinFrontend {
...
npm {
...
dependency "mprogress"
...
}
...
}
...
gildor
03/20/2018, 7:21 AMjonathan
03/20/2018, 7:26 AMjonathan
03/20/2018, 7:34 AMModule.bundle.js
file. What other steps do I need to do? I thought that the dependency clause was it?jonathan
03/20/2018, 6:44 PMmprogress
uses a factory function: in its source file, module.exports = factory()
, which later returns an object MProgress
that has all the definitions. I just did this:
@JsModule("mprogress")
external class Mprogress(params: Json) {
fun start()
fun end()
fun set(percent: Double)
fun inc()
}
Is there a way to reference that module's "main export" or something like that?gildor
03/20/2018, 11:34 PMgildor
03/20/2018, 11:38 PMmodule.exports = factory ()
is just part of module declarationgildor
03/20/2018, 11:40 PM@JsModule("mprogress")
instead of @JsModule("Mprogress")
?jonathan
03/21/2018, 12:22 AMgildor
03/21/2018, 1:25 AMjonathan
03/21/2018, 5:15 AMgildor
03/21/2018, 6:05 AM@JsModule("mprogress/mprogress.min.js")
external class Mprogress() {
fun start()
fun end()
fun set(percent: Double)
fun inc()
}
gildor
03/21/2018, 6:06 AMjonathan
03/21/2018, 6:18 AMgildor
03/21/2018, 6:19 AMMprogress
in this case