CoroutineScopeOwner

interface CoroutineScopeOwner

This interface gives your class ability to execute UseCase and FlowUseCase Coroutine use cases. You may find handy to implement this interface in custom Presenters, ViewHolders etc. It is your responsibility to cancel coroutineScope when when all running tasks should be stopped.

Types

FlowUseCaseConfig
Link copied to clipboard
class FlowUseCaseConfig<T>
Holds references to lambdas and some basic configuration used to process results of Flow use case.
UseCaseConfig
Link copied to clipboard
class UseCaseConfig<T>
Holds references to lambdas and some basic configuration used to process results of Coroutine use case.

Functions

defaultErrorHandler
Link copied to clipboard
open fun defaultErrorHandler(exception: Throwable)
This method is called when coroutine launched with launchWithHandler throws an exception and this exception isn't CancellationException.
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
execute
Link copied to clipboard
open fun <T> FlowUseCase<Unit, T>.execute(config: CoroutineScopeOwner.FlowUseCaseConfig.Builder<T>.() -> Unit)
open suspend fun <T> UseCase<Unit, T>.execute(cancelPrevious: Boolean = true): Result<T>
Synchronously executes use case and saves it's Deferred.
open fun <T> UseCase<Unit, T>.execute(config: CoroutineScopeOwner.UseCaseConfig.Builder<T>.() -> Unit)
Asynchronously executes use case and saves it's Deferred.
open fun <ARGS, T> FlowUseCase<ARGS, T>.execute(args: ARGS, config: CoroutineScopeOwner.FlowUseCaseConfig.Builder<T>.() -> Unit)
Asynchronously executes use case and consumes data from flow on UI thread.
open suspend fun <ARGS, T> UseCase<ARGS, T>.execute(args: ARGS, cancelPrevious: Boolean = true): Result<T>
Synchronously executes use case and saves it's Deferred.
open fun <ARGS, T> UseCase<ARGS, T>.execute(args: ARGS, config: CoroutineScopeOwner.UseCaseConfig.Builder<T>.() -> Unit)
Asynchronously executes use case and saves it's Deferred.
getWorkerDispatcher
Link copied to clipboard
open fun getWorkerDispatcher(): CoroutineDispatcher
Provides Dispatcher for background tasks.
hashCode
Link copied to clipboard
open fun hashCode(): Int
launchWithHandler
Link copied to clipboard
open fun launchWithHandler(block: suspend CoroutineScope.() -> Unit)
Launch suspend block in coroutineScope.
toString
Link copied to clipboard
open fun toString(): String

Properties

coroutineScope
Link copied to clipboard
abstract val coroutineScope: CoroutineScope
CoroutineScope scope used to execute coroutine based use cases.

Inheritors

BaseCrViewModel
Link copied to clipboard