JsReference

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
fun <T : Any> JsReference<T>.get(): T

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
fun <T : JsAny> JsAny.unsafeCast(): T

Cast JsAny to other Js type without runtime check

Since Kotlin 1.8