All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.dokar.quickjs.binding.Bindings.kt Maven / Gradle / Ivy

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
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy