LifecycleGraph

sealed class LifecycleGraph

This class is NOT thread-safe. Attaching and detaching from scopes should be performed from the main thread.

Types

Node
Link copied to clipboard
class Node(owner: Any) : LifecycleGraph
Root
Link copied to clipboard
class Root(owner: Any?) : LifecycleGraph

Functions

addChild
Link copied to clipboard
fun addChild(child: LifecycleGraph.Node)
Adds child as a dependent lifecycle sharing the same scope and attachment status as this instance.
addChildren
Link copied to clipboard
fun addChildren(childrenToAdd: Collection<LifecycleGraph.Node>)
addListener
Link copied to clipboard
fun addListener(listener: LifecycleListener): CancellationToken
dumpTree
Link copied to clipboard
fun dumpTree(): String
hasChild
Link copied to clipboard
fun hasChild(child: LifecycleGraph.Node): Boolean
onDidAttach
Link copied to clipboard
fun onDidAttach(validity: LifecycleListener.Validity = LifecycleListener.Validity.Infinite, listener: () -> Unit): CancellationToken
Registers listener for the DidAttach event.
onDidDetach
Link copied to clipboard
fun onDidDetach(validity: LifecycleListener.Validity = LifecycleListener.Validity.Infinite, listener: () -> Unit): CancellationToken
Registers listener for the DidDetach event.
onWillAttach
Link copied to clipboard
fun onWillAttach(validity: LifecycleListener.Validity = LifecycleListener.Validity.Infinite, listener: () -> Unit): CancellationToken
Registers listener for the WillAttach event.
onWillDetach
Link copied to clipboard
fun onWillDetach(validity: LifecycleListener.Validity = LifecycleListener.Validity.Infinite, listener: () -> Unit): CancellationToken
Registers listener for the WillDetach event.
removeChild
Link copied to clipboard
fun removeChild(child: LifecycleGraph.Node)
removeChildren
Link copied to clipboard
fun removeChildren(childrenToRemove: Collection<Lifecycle>)
removeListener
Link copied to clipboard
fun removeListener(listener: LifecycleListener)
runOnceIfAttached
Link copied to clipboard
fun runOnceIfAttached(runner: suspend CoroutineScope.() -> Unit): Boolean
Launches runner right away if attached, does nothing otherwise.
topMostNode
Link copied to clipboard
fun topMostNode(): LifecycleGraph
whileAttached
Link copied to clipboard
fun whileAttached(runner: suspend CoroutineScope.() -> Unit): CancellationToken
Registers runner to be launched each time this lifecycle is attached to a scope and cancelled once detached.

Properties

debugDescription
Link copied to clipboard
val debugDescription: String
isAttached
Link copied to clipboard
val isAttached: Boolean

Inheritors

LifecycleGraph
Link copied to clipboard
LifecycleGraph
Link copied to clipboard