W3cubDocs

/JavaScript

FinalizationRegistry.finalizationRegistry

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

Syntax

new FinalizationRegistry([callback]);

Parameters

callback Optional
The callback function this registry should use. If provided, this must be a function.

Examples

Creating a new registry

You create the registry passing in the callback:

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

Specifications

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
FinalizationRegistry() constructor 84 84 79 No No No
Mobile
Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
FinalizationRegistry() constructor 84 84 79 No No No
Server
Node.js
FinalizationRegistry() constructor 13.0.0
Disabled
13.0.0
Disabled
Disabled From version 13.0.0: this feature is behind the --harmony-weak-refs runtime flag.

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry/FinalizationRegistry