https://github.com/scala-js/scala-js-fake-weakreferences
Compatibility stubs for java.lang.ref.* in Scala.js
https://github.com/scala-js/scala-js-fake-weakreferences
Last synced: 9 months ago
JSON representation
Compatibility stubs for java.lang.ref.* in Scala.js
- Host: GitHub
- URL: https://github.com/scala-js/scala-js-fake-weakreferences
- Owner: scala-js
- License: apache-2.0
- Created: 2021-05-20T17:39:12.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-06T10:42:26.000Z (almost 4 years ago)
- Last Synced: 2025-01-10T00:35:40.504Z (10 months ago)
- Language: Scala
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# scalajs-fake-weakreferences
`scalajs-fake-weakreferences` provides compatibility stubs for `java.lang.ref.*` APIs in Scala.js.
It preserves the support that was available in Scala.js core previous to v1.6.0.
The various `Reference`s provided by `scalajs-fake-weakreferences` do not behave correctly.
They always act as strong references.
`scalajs-fake-weakreferences` should only be used if upgrading to Scala.js v1.6.0+ causes linking errors about `java.lang.ref.*` in an existing application.
New applications should avoid this library.
## Usage
Add the following dependency to your project settings:
```scala
libraryDependencies += ("org.scala-js" %%% "scalajs-fake-weakreferences" % "1.0.0").cross(CrossVersion.for3Use2_13)
```
When using a `crossProject`, add the above in `.jsSettings(...)`.
You can then use the classes defined in `java.lang.ref.*`.
Keep in mind that they will hold *strong* references, which will prevent the target objects from beging garbage-collected.
## License
`scalajs-fake-weakreferences` is distributed under the [Apache 2.0 license](./LICENSE.txt), like Scala.js itself.