JsReference

Since Kotlin

2.2
actual sealed external interface JsReference<out T : Any> : JsAny(source)

JavaScript value that can serve as a reference for any Kotlin value.

In JavaScript, it behaves like an immutable empty object with a null prototype. When passed back to Kotlin/Wasm, the original value can be retrieved using the get method.

Since Kotlin

1.8

Functions

Link copied to clipboard
Link copied to clipboard
actual inline fun <T : Any> JsReference<T>.get(): T
Since Kotlin 2.2

Retrieve original Kotlin value from JsReference

Since Kotlin 1.8
Link copied to clipboard

For a Dynamic value caught in JS, returns the corresponding Throwable if it was thrown from Kotlin, or null otherwise.

Since Kotlin 1.8
Link copied to clipboard
Since Kotlin 2.2

Cast JsAny to other Js type without runtime check

Since Kotlin 1.8