FinalizationRegistry.prototype.unregister()
The unregister()
method unregisters a target object from a
FinalizationRegistry
instance.
Syntax
unregister(unregisterToken)
Parameters
unregisterToken
- : The token used with the
FinalizationRegistry.prototype.register
method when registering the target object. Multiple cells registered with the sameunregisterToken
will be unregistered together.
- : The token used with the
Return value
A boolean value that is true
if at least one cell was unregistered and false
if no cell was unregistered.
Exceptions
TypeError
- : Thrown when
unregisterToken
is not an object.
- : Thrown when
Description
When a target object has been reclaimed, it is no longer registered in the registry.
There is no need to call unregister
in your cleanup callback. Only call
unregister
if you haven't received a cleanup callback and no longer need
to receive one.