I need to build a Weak-Valued cache for my KMP pro...
# javascript
d
I need to build a Weak-Valued cache for my KMP project; including Kotlin/JS, so I need weak references on each platform. WeakReference is explicitly implemented for Kotlin/Native, to complement the existing JVM one. But I don't see any equivalent support for Kotlin/JS, even though JavaScript does provide a WeakRef. Is there a way to make this usable from Kotlin? Thanks. I'm experienced in KMP/KMM (`expect`/`actual`), but new to JavaScript interop.
e
Copy code
external class WeakRef<T>(targetObject: T) {
    fun deref(): T?
}
👍 1
d
Thanks @ephemient 👌 It didn't occur to me about
external