@JsModule("mermaid")
@JsNonModule
@JsName("mermaid")
external object Mermaid {
fun run()
}
The first time I call Mermaid.run() it works, but any subsequent call after dynamically adding a diagram to the document fails with "Uncaught TypeError: mermaid.run is not a function"
t
turansky
11/24/2023, 11:43 PM
JS
Copy code
export default mermaid;
Kotlin
Copy code
@file:JsModule("mermaid")
@JsName("default")
external object Mermaid {
fun run()
}
r
Reuben Firmin
11/25/2023, 1:41 AM
Ah, makes sense - thanks. (I had to add @file:JsNonModule also to make it happy, but it works.)