Creates a new context and registers it as destroyable in the current context so the new context is destroyed when the parent context is destroyed.
Destroys this context. This unregisters the context from its parent context and destroys all destroyables registered within this context.
Registers the given destroyable to be destroyed when this context is destroyed.
The destroyable to register.
Runs the given function within this context. New contexts created in this function are automatically registered as child context within this context so they are destroyed when this context is destroyed. Note that this cannot work when the function is asynchronous.
The function to run within this context.
The return value of the called function.
Unregisters a destroyable which was previously registered with registerDestroyable.
The destroyable to unregister.
Static
getThe current context or null if none.
A destroyable context hierarchy.