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 withnew
. Attempting to call it withoutnew
throws aTypeError
.
Parameters
callback
- : The callback function this registry should use.