I'm trying to make a multiplatform WeakrefMap, but...
# multiplatform
m
I'm trying to make a multiplatform WeakrefMap, but for some reason WeakRef/WeakMap is not available on the JS target. What can I do instead?
e
the WeakRef proposal for JS was only accepted for ES12 and Kotlin/JS still targets ES5, so you can't really do anything (in a cross-platform safe way)
m
But isn't it already available in every browser and nodejs? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap
e
Kotlin/JS isn't up to date with the latest JS standards
m
I see, so there's currently no way to have a weakmap equivalent in Kotlin/JS?
c
In case anyone searches for this in the future, it's been added to the
kotlin-js
module in the official Kotlin Wrappers I made a multiplatform wrapper: https://opensavvy.gitlab.io/groundwork/pedestal/api-docs/weak/index.html (discussion in #C078Z1QRHL3)