addOnRepeatingJob

inline fun LifecycleOwner.addOnRepeatingJob(state: Lifecycle.State, lazyThreadSafetyMode: LazyThreadSafetyMode = LazyThreadSafetyMode.NONE, crossinline block: suspend CoroutineScope.() -> Unit): Lazybones<Job>

Author

skydoves (Jaewoong Eum)

Collects from the flow when the lifecycle is at least Lifecycle.State.STARTED and STOPS the collection when it's STOPPED. It automatically restarts collecting when the lifecycle is Lifecycle.State.STARTED again.

Return

Lazybones A lazybones wrapper for creating a lifecycle-aware property.

Parameters

state

Lifecycle.State in which the coroutine running block starts.

lazyThreadSafetyMode

Specifies how a Lazy instance synchronizes initialization among multiple threads.

block

A block that will be executed on the specific lifecycle.

inline fun <T> LifecycleOwner.addOnRepeatingJob(state: Lifecycle.State, flow: Flow<T>, lazyThreadSafetyMode: LazyThreadSafetyMode = LazyThreadSafetyMode.NONE, crossinline block: (T) -> Unit): Lazybones<Job>

Author

skydoves (Jaewoong Eum)

Collects from the flow when the lifecycle is at least Lifecycle.State.STARTED and STOPS the collection when it's STOPPED. It automatically restarts collecting when the lifecycle is Lifecycle.State.STARTED again.

Return

Lazybones A lazybones wrapper for creating a lifecycle-aware property.

Parameters

flow

A flow that will be collected on the specific lifecycle.

state

Lifecycle.State in which the coroutine running block starts.

lazyThreadSafetyMode

Specifies how a Lazy instance synchronizes initialization among multiple threads.

block

A block that will be executed on the specific lifecycle.