//Extensions for Jetpack Lifecycle/it.czerwinski.android.lifecycle.livedata/intervalLiveData

intervalLiveData

[androidJvm]
Content
fun intervalLiveData(timeInMillis: Long, context: CoroutineContext = EmptyCoroutineContext): LiveData<Int>
More info

Returns a LiveData emitting a sequence of integer values, spaced by a given timeInMillis.

Delay between subsequent emissions will be applied on a thread determined by the given context.

Example:

val intervalLiveData: LiveData = intervalLiveData(timeInMillis = 1000L)

Since

1.2.0

[androidJvm]
Content
fun intervalLiveData(context: CoroutineContext = EmptyCoroutineContext, timeInMillis: (Int) -> Long): LiveData<Int>
More info

Returns a LiveData emitting a sequence of integer values, spaced by a result of a given timeInMillis function invoked on the next value.

Delay between subsequent emissions will be applied on a thread determined by the given context.

Example:

val intervalLiveData: LiveData = intervalLiveData { index -> (index + 1) * 1000L }

Since

1.2.0