I have a problem trying to call sockjs-client (<ht...
# javascript
r
I have a problem trying to call sockjs-client (https://github.com/sockjs/sockjs-client) from my kotlin code - I have used @file:JsModule("sockjs-client") and @JsName("SockJS") to define an external class / function for SockJS. But I either get Uncaught TypeError: SockJS is not a constructor or Uncaught TypeError: SockJS is not a function 🤔 (also I am not really good with javascript 😄 )
b
Try with jsname default
If the module exports the client as default
r
Ah thx will give it a try
b
Also try it as val and as class
a
From the looks of it you need to put the
@JsModule
annotation on the external class declaration directly, like so:
Copy code
@JsModule("sockjs-client")
external class SockJs(...) { ... }
r
thx so much @anton.bannykh that worked
👍 1