LIFETIME
bolt Methods
on.cleanup
on.cleanup(handler): Unsubscribe;
Register a cleanup handler for an object. This function is called when the object is finalized.
handler
() => void
The function that should run when this object is cleaned up.
returns
Unsubscribe
A function that can be used to unregister the cleanup handler.
link
link(parent, child): Unsubscribe;
Link an object to its owner. When an object’s owner is [finalized], it will be [finalized].
parent
object
The object to link the child to.
child
object
The object to link to the parent.
returns
Unsubscribe
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
finalize(object): void;
Finalize an object. The object’s cleanup handlers will be called, and all linked objects will be finalized.
object
object
The object to finalize.