coderef

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: 155
Edge
12–83Not supported
84+Supportedsince Jul 16, 2020
Current: 154
Firefox
1–78Not supported
79+Supportedsince Jul 28, 2020
Current: 157
Safari
1–14Not supported
14.1+Supportedsince Apr 26, 2021
Current: 27
MobileChrome Android
18–83Not supported
84+Supportedsince Jul 27, 2020
Current: 155
Firefox Android
4–68Not supported
79+Supportedsince Jul 28, 2020
Current: 157
Safari iOS
1–14Not supported
14.5+Supportedsince Apr 26, 2021
Current: 27

How 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
}

Sub-features

Support for each part of the feature (10). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
FinalizationRegistry84847914.1847914.5
FinalizationRegistry.FinalizationRegistry84847914.1847914.5
FinalizationRegistry.register84847914.1847914.5
FinalizationRegistry.register.symbol_as_target10910914616.410914616.4
FinalizationRegistry.unregister84847914.1847914.5
FinalizationRegistry.unregister.symbol_as_target10910914616.410914616.4
WeakRef84847914.1847914.5
WeakRef.WeakRef84847914.1847914.5
WeakRef.WeakRef.symbol_as_target10910914616.410914616.4
WeakRef.deref84847914.1847914.5