https://github.com/alexzhirkevich/keight
JavaScript runtime for Kotlin Multiplatform. Written entirely in Kotlin. Works on every Kotlin target.
https://github.com/alexzhirkevich/keight
javascript js js-engine js-runtime kmp kotlin kotlin-multiplatform multiplatform
Last synced: 5 months ago
JSON representation
JavaScript runtime for Kotlin Multiplatform. Written entirely in Kotlin. Works on every Kotlin target.
- Host: GitHub
- URL: https://github.com/alexzhirkevich/keight
- Owner: alexzhirkevich
- License: mit
- Created: 2024-10-17T21:52:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-26T10:54:53.000Z (9 months ago)
- Last Synced: 2025-09-26T12:29:01.425Z (9 months ago)
- Topics: javascript, js, js-engine, js-runtime, kmp, kotlin, kotlin-multiplatform, multiplatform
- Language: Kotlin
- Homepage:
- Size: 512 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Keight
JavaScript runtime for Kotlin Multiplatform. Written entirely in Kotlin. Works on every Kotlin target.
Powers After Effects expressions in [Compottie](https://github.com/alexzhirkevich/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
```toml
[versions]
keight=""
[libraries]
keight = { module = "io.github.alexzhirkevich:keight", version.ref = "keight" }
```
# Usage
## Basic
```kotlin
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)
```