https://github.com/scala-js/scala-js-weakreferences
Implementation of java.lang.ref.{WeakReference,ReferenceQueue} for Scala.js
https://github.com/scala-js/scala-js-weakreferences
Last synced: 3 months ago
JSON representation
Implementation of java.lang.ref.{WeakReference,ReferenceQueue} for Scala.js
- Host: GitHub
- URL: https://github.com/scala-js/scala-js-weakreferences
- Owner: scala-js
- License: apache-2.0
- Created: 2021-05-24T16:07:57.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-06T10:34:19.000Z (almost 4 years ago)
- Last Synced: 2025-04-28T18:45:14.452Z (7 months ago)
- Language: Scala
- Size: 15.6 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# scalajs-weakreferences
`scalajs-weakreferences` provides a correct implementation of `java.lang.ref.WeakReference` and `java.lang.ref.ReferenceQueue` in Scala.js.
It assumes that the target platform supports JavaScript's `WeakRef` and `FinalizationRegistry`, which are becoming standard in ECMAScript 2021.
Attempts to use `WeakReference` or `ReferenceQueue` will throw `ReferenceError`s if they are not supported.
## Usage
Add the following dependency to your project settings:
```scala
libraryDependencies += ("org.scala-js" %%% "scalajs-weakreferences" % "1.0.0").cross(CrossVersion.for3Use2_13)
```
When using a `crossProject`, add the above in `.jsSettings(...)`.
You can then use `java.lang.ref.WeakReference` and `java.lang.ref.ReferenceQueue`.
## License
`scalajs-weakreferences` is distributed under the [Apache 2.0 license](./LICENSE.txt), like Scala.js itself.