简体   繁体   中英

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? I only find solution for calling JS functions but not for calling Kotlin functions

for example: JS:

function callKotlinHelloWorld(){
  //excute stuff
}

Kotlin:

fun HelloWorld(){
  println("Hello World")
}

I heared from Kotlin/JS but there are some difrents from the normal JS and Kotlin

Thanks for helping

You might want to have a look at 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. This gives you all the advantages of executing in a JavaScript runtime, such as faster startup and a reduced memory footprint. With kotlinx-nodejs, you have typesafe access to the Node.js API directly from your Kotlin code.

As per the corresponding section in the documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM