Skip to main content
Version: 3.21.2

FinalizationRegistry()

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(heldValue) { /* … */ })

Note: FinalizationRegistry() can only be constructed with new. Attempting to call it without new throws a TypeError.

Parameters

  • callback
    • : The callback function this registry should use.