bind

fun <T : Any> JsObject.bind(name: String, instance: T, build: BindScope<T>.() -> Unit): JsObject

Binds a Kotlin object into a fresh JavaScript object.

js.global.bind("clock", myClock) {
property("now", Clock::now)
method("tick") { advance(); Unit }
}