Skip to content

JavaScript runtime for Kotlin Multiplatform. Written entirely in Kotlin. Works on every Kotlin target.

License

Notifications You must be signed in to change notification settings

alexzhirkevich/keight

Repository files navigation

Keight

JavaScript runtime for Kotlin Multiplatform. Written entirely in Kotlin. Works on every Kotlin target.

Powers After Effects expressions in Compottie library.

Warning

Project is experimental and WIP.
The runtime is not currently ES-compliant.
No support guarantees.
Use only for evaluation purposes or on your own risk

Installation

[versions]
keight="<version>"

[libraries]
keight = { module = "io.github.alexzhirkevich:keight", version.ref = "keight" }

Usage

Basic

val engine = JSEngine(JSRuntime(coroutineContext))
val code = "const js = 'JS'; 'Hello, ' + js"

val script = engine.compile(code)
val result = script.invoke()?.toKotlin(engine.runtime)
println(result)

// or

val result = engine.evaluate(code)
println(result)

About

JavaScript runtime for Kotlin Multiplatform. Written entirely in Kotlin. Works on every Kotlin target.

Topics

Resources

License

Stars

Watchers

Forks

Languages