class NodeJSAPI
The API for working with the NodeJS world. Accessed by using a nodejs block: the methods on this class are in scope when inside the code block.
asValue |
Casts any object to being a JavaScript object. fun Any.asValue(): Value |
bind |
Use this in property delegate syntax to access top level global variables in the NodeJS context. By declaring
a variable as fun <T> bind(default: T? = null): Binder<T> |
cast |
Converts the Value to a JVM type T in the following way: fun <T> Value.cast(): T |
eval |
Evaluates the given JavaScript string and casts the result to the desired JVM type. You can request a cast to interfaces that map to JS objects, collections, the Graal/Polyglot Value type, boxed primitives and more. fun <T> eval(javascript: String): T |
get |
Allows you to read JS properties of the given Value using Kotlin indexing syntax. operator fun <T> Value.get(key: String): T operator fun Value.get(key: String): Value |
run |
Evaluates the given JavaScript but throws away any result. fun run(javascript: String): Unit |
set |
Allows you to set JS properties of the given Value using Kotlin indexing syntax. operator fun Value.set(key: String, value: Any?): Unit |