Skip to content

Instantly share code, notes, and snippets.

@pavlospt
Created May 2, 2020 10:34
Show Gist options
  • Save pavlospt/1e78f8868376351267e2028702118fa1 to your computer and use it in GitHub Desktop.
Save pavlospt/1e78f8868376351267e2028702118fa1 to your computer and use it in GitHub Desktop.
NoResultUseCase.kt
abstract class NoResultUseCase<in Params> {
protected abstract val workDispatcher: CoroutineDispatcher
abstract suspend fun run(params: Params)
suspend operator fun invoke(params: Params) = withContext(workDispatcher) {
run(params)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment