How would I create a module definition jszip? it h...
# webassembly
m
How would I create a module definition jszip? it has a
namespace JSZip
with
new(): this;
and
(): JSZip
but I can't figure out how to call it. I tried
external fun JSZip
as well as
external class JSZip
and both give errors.
v
Copy code
@file:JsModule("jszip")

external class JSZip {
    constructor()

    fun file(name: String, data: String, options: FileOptions = definedExternally): JSZip 
    // ... Other functions, didn't bother to write them all out
}

external interface FileOptions { /* ... */ }
Try this? OR try this:
Copy code
external class JSZip {
    companion object {
        operator fun invoke(): JSZip
    }
}
m
1.
Uncaught TypeError: _ref_anN6aXA_.JSZip is not a constructor
2. See image
v
Try adding:
@JsName("default")
to the
external class JSZip
maybe it's exported via default export.
t
We already have
JsZip
declarations in Kotlin Wrappers
I fixed WASM compatibility. In next release (probably today)
JSZip
should work on WASM too.
Ready for use in Wrappers
2025.6.11
🎉🎉🎉