Weak referencesBaseline · Widely available
The WeakRef and FinalizationRegistry objects hold references to garbage-collectable objects without creating strong references that prevent their garbage collection.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Apr 26, 2021. Widely available since Oct 26, 2023.
Browser support
DesktopChrome
1–83Not supported
84+Supportedsince Jul 27, 2020
Current: 155Edge
12–83Not supported
84+Supportedsince Jul 16, 2020
Current: 154Firefox
1–78Not supported
79+Supportedsince Jul 28, 2020
Current: 157Safari
1–14Not supported
14.1+Supportedsince Apr 26, 2021
Current: 27MobileChrome Android
18–83Not supported
84+Supportedsince Jul 27, 2020
Current: 155Firefox Android
4–68Not supported
79+Supportedsince Jul 28, 2020
Current: 157Safari iOS
1–14Not supported
14.5+Supportedsince Apr 26, 2021
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: FinalizationRegistry.
Feature detection
JS · check before using
if (typeof WeakRef !== "undefined") {
// WeakRef is available
}Documentation (MDN)
Specification
Sub-features
Support for each part of the feature (10). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| FinalizationRegistry | 84 | 84 | 79 | 14.1 | 84 | 79 | 14.5 |
| FinalizationRegistry.FinalizationRegistry | 84 | 84 | 79 | 14.1 | 84 | 79 | 14.5 |
| FinalizationRegistry.register | 84 | 84 | 79 | 14.1 | 84 | 79 | 14.5 |
| FinalizationRegistry.register.symbol_as_target | 109 | 109 | 146 | 16.4 | 109 | 146 | 16.4 |
| FinalizationRegistry.unregister | 84 | 84 | 79 | 14.1 | 84 | 79 | 14.5 |
| FinalizationRegistry.unregister.symbol_as_target | 109 | 109 | 146 | 16.4 | 109 | 146 | 16.4 |
| WeakRef | 84 | 84 | 79 | 14.1 | 84 | 79 | 14.5 |
| WeakRef.WeakRef | 84 | 84 | 79 | 14.1 | 84 | 79 | 14.5 |
| WeakRef.WeakRef.symbol_as_target | 109 | 109 | 146 | 16.4 | 109 | 146 | 16.4 |
| WeakRef.deref | 84 | 84 | 79 | 14.1 | 84 | 79 | 14.5 |