A FinalizationRegistry object lets you request a callback when a value is garbage-collected.
Documentation FinalizationRegistry by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Constructor
Methods
register(target:{}, heldValue:T, ?unregisterToken:{}):Void
Registers a target object with the registry, associating it with a held value and an optional unregister token.
unregister(unregisterToken:{}):Bool
Unregisters any registrations associated with the given unregister token.
Returns true if at least one registration was removed.