commonMain.com.dokar.quickjs.binding.JsObject.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
/**
* Create a delegate and mark the map as a JavaScript object.
*/
fun Map.toJsObject(): JsObject = JsObject(this)
/**
* The delegate of a property [Map] represents a JavaScript object.
*/
class JsObject(private val map: Map) : Map by map {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is JsObject) return false
if (map != other.map) return false
return true
}
override fun hashCode(): Int {
return map.hashCode()
}
}