FinalizationRegistry() constructor

The FinalizationRegistry constructor creates a FinalizationRegistry object that uses the given callback.

Syntax

// Arrow callback function
new FinalizationRegistry(heldValue => { ... } )

// Callback function
new FinalizationRegistry(callbackFn)

// Inline callback function
new FinalizationRegistry(function callbackFn(heldValue) { ... })

Parameters

callback

The callback function this registry should use.

Examples

Creating a new registry

You create the registry passing in the callback:

const registry = new FinalizationRegistry(heldValue => {
  // ....
});

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
FinalizationRegistry
84
84
79
No
70
14.1
84
84
79
60
14.5
14.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry/FinalizationRegistry