To call a Kotlin method using native function invocation in JavaScript, you need to follow these steps:
@JsName
annotation, and declare it as external
to indicate that it will be implemented in JavaScript:100 chars5 lines
kotlin2js
compiler:36 chars2 lines
@JsName
annotation:index.tsx49 chars2 lines
Note: The name specified in the @JsName
annotation must match the name used to call the function in JavaScript.
That's it! Now you can call your Kotlin functions from your JavaScript code using native function invocation.
gistlibby LogSnag