Root

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
attach
Link copied to clipboard
fun attach(scope: CoroutineScope): CancellationToken
Attach this lifecycle instance to a coroutine scope the method has been called in.
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

Extensions

attachToMainScope
Link copied to clipboard
fun LifecycleGraph.Root.attachToMainScope(): CancellationToken
fun LifecycleGraph.Root.attachToMainScope(unhandledExceptionHandler: (CoroutineContext, Throwable) -> Unit): CancellationToken