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() => voidThe function that should run when this object is cleaned up.
returnsUnsubscribeA 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].
parentobjectThe object to link the child to.
childobjectThe object to link to the parent.
returnsUnsubscribeA 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.
objectobjectThe object to finalize.