Skip to content

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

Stars

16 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages