[英]call/run function from Kotlin with Nodejs
I've wrote some lines of code in Kotlin now i want to execute this function from Javascrip or Nodejs is that possible?我已经在 Kotlin 中编写了一些代码行,现在我想从 Javascrip 或 Nodejs 执行这个 function 这可能吗? I only find solution for calling JS functions but not for calling Kotlin functions我只找到调用 JS 函数的解决方案,但没有找到调用 Kotlin 函数的解决方案
for example: JS:例如:JS:
function callKotlinHelloWorld(){
//excute stuff
}
Kotlin: Kotlin:
fun HelloWorld(){
println("Hello World")
}
I heared from Kotlin/JS but there are some difrents from the normal JS and Kotlin我从 Kotlin/JS 那里听说,但与普通的 JS 和 Kotlin 有一些不同
Thanks for helping感谢您的帮助
You might want to have a look at https://kotlinlang.org/docs/js-overview.html .您可能想看看https://kotlinlang.org/docs/js-overview.html 。
Edit:编辑:
The Node.js target provided by Kotlin/JS enables you to create applications that run on a server or are executed on serverless infrastructure. Kotlin/JS 提供的 Node.js 目标使您能够创建在服务器上运行或在无服务器基础设施上执行的应用程序。 This gives you all the advantages of executing in a JavaScript runtime, such as faster startup and a reduced memory footprint.这为您提供了在 JavaScript 运行时执行的所有优势,例如更快的启动和减少的 memory 占用空间。 With kotlinx-nodejs, you have typesafe access to the Node.js API directly from your Kotlin code.使用 kotlinx-nodejs,您可以直接从 Kotlin 代码安全地访问 Node.js API。
As per the corresponding section in the documentation 根据文档中的相应部分
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.