FinalizationRegistry() constructor

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

Specification
WeakRefs
The definition of 'FinalizationRegistry constructor' in that specification.

Browser compatibility

BCD tables only load in the browser

See also