You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While #35 fixes the name mangling there are further issues preventing direct usage from Javascript. I recommend holding this ticket open until we can provide a slightly massaged API for js consumption and show a working example.
davertay-j
changed the title
Message.encode() Method Not Available To Javascript
Public API Not Directly Usable From Javascript
Oct 29, 2020
I actually do have it working now. The issue was difficulty of interop with parts of the API that require List<T> objects an the inability to invoke Array.toList().
The solution is to use ArrayList instead and javascript arrays can be converted to such e.g.:
Unable to invoke the
Message.encode
method from js, method is defined here:https://github.com/JuulLabs/koap/blob/main/koap/src/commonMain/kotlin/Encoder.kt#L56
Example:
Results in the exception: "Unhandled Rejection (TypeError): koap.encode is not a function"
IMHO there needs to be some javascript unit tests added to exercise the API to verify it performs as expected when published as a library.
The text was updated successfully, but these errors were encountered: