jsMain.io.github.vinccool96.ref.WeakReferenceFactory.kt Maven / Gradle / Ivy
package io.github.vinccool96.ref
actual object WeakReferenceFactory {
actual fun createWeakRef(referent: T): WeakReference {
return JSCoreWeakRef(referent)
}
private class JSCoreWeakRef(referent: T) : WeakReference {
private var ref: T? = referent
override val value: T?
get() = this.get()
override fun get(): T? {
return this.ref
}
override fun clear() {
this.ref = null
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy