LifecycleGraph

sealed class LifecycleGraph

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

Types

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

Functions

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.

Link copied to clipboard
fun addChildren(childrenToAdd: Collection<LifecycleGraph.Node>)
Link copied to clipboard
fun addListener(listener: LifecycleListener): CancellationToken
Link copied to clipboard
fun dumpTree(): String
Link copied to clipboard
fun hasChild(child: LifecycleGraph.Node): Boolean
Link copied to clipboard
fun onDidAttach(validity: LifecycleListener.Validity = LifecycleListener.Validity.Infinite, listener: () -> Unit): CancellationToken

Registers listener for the DidAttach event.

Link copied to clipboard
fun onDidDetach(validity: LifecycleListener.Validity = LifecycleListener.Validity.Infinite, listener: () -> Unit): CancellationToken

Registers listener for the DidDetach event.

Link copied to clipboard
fun onWillAttach(validity: LifecycleListener.Validity = LifecycleListener.Validity.Infinite, listener: () -> Unit): CancellationToken

Registers listener for the WillAttach event.

Link copied to clipboard
fun onWillDetach(validity: LifecycleListener.Validity = LifecycleListener.Validity.Infinite, listener: () -> Unit): CancellationToken

Registers listener for the WillDetach event.

Link copied to clipboard
fun removeChild(child: LifecycleGraph.Node)
Link copied to clipboard
fun removeChildren(childrenToRemove: Collection<Lifecycle>)
Link copied to clipboard
fun removeListener(listener: LifecycleListener)
Link copied to clipboard
fun runOnceIfAttached(runner: suspend CoroutineScope.() -> Unit): Boolean

Launches runner right away if attached, does nothing otherwise.

Link copied to clipboard
fun topMostNode(): LifecycleGraph
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

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

Inheritors

Link copied to clipboard
Link copied to clipboard