Register a cleanup handler for an object. This function is called when the object is finalized.
() => void
The function that should run when this object is cleaned up.
A function that can be used to unregister the cleanup handler.
link(parent, child): Unsubscribe;
Link an object to its owner. When an object’s owner is [finalized], it will be [finalized].
The object to link the child to.
The object to link to the parent.
A function that can be used to unlink the child from the parent, which will prevent it from being cleaned up when the parent is cleaned up.
Finalize an object. The object’s cleanup handlers will be called, and all linked objects will be finalized.
The object to finalize.