commonMain.ru.astrainteractive.klibs.paging.PagingCollector.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of paging-jvm Show documentation
Show all versions of paging-jvm Show documentation
Kotlin Multiplatform paging library
package ru.astrainteractive.klibs.paging
import kotlinx.coroutines.flow.StateFlow
import ru.astrainteractive.klibs.paging.context.PageContext
import ru.astrainteractive.klibs.paging.state.PagingState
/**
* This is a State Holder for your paging. Define it inside Repository or ViewModel
*/
interface PagingCollector {
/**
* Current state
*/
val state: StateFlow>
/**
* Reset [state] to initial value and perform [cancelAndJoin]
*/
suspend fun resetAndJoin()
/**
* Cancels current [loadNextPage] job
*/
suspend fun cancelAndJoin()
/**
* Update current [state]
*/
fun update(pagingState: (PagingState) -> PagingState)
/**
* Load next page if last page not reached
*/
suspend fun loadNextPage()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy