commonMain.com.dokar.quickjs.binding.Bindings.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quickjs-kt Show documentation
Show all versions of quickjs-kt Show documentation
A QuickJS binding for idiomatic Kotlin, with Async/DSL/ES Modules support.
The newest version!
package com.dokar.quickjs.binding
/**
* The base binding type.
*/
sealed interface Binding
/**
* The JavaScript object binding. Properties and functions can be defined on the object.
*/
interface ObjectBinding : Binding {
val properties: List
val functions: List
fun getter(name: String): Any?
fun setter(name: String, value: Any?)
fun invoke(name: String, args: Array): Any?
}
/**
* The JavaScript function binding.
*/
fun interface FunctionBinding : Binding {
fun invoke(args: Array): R
}
/**
* The JavaScript async function binding. This provides a suspend callback.
*/
fun interface AsyncFunctionBinding : Binding {
suspend fun invoke(args: Array): R
}