-
-
Save GuilhE/6da6c965ba7382b54f591ca25c10c23e to your computer and use it in GitHub Desktop.
Medium articles - KMM with MVI+FSM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Flow<*>.subscribe( | |
onEach: (item: Any) -> Unit, | |
onComplete: () -> Unit, | |
onThrow: (error: Throwable) -> Unit | |
): Job = | |
this.onEach { onEach(it as Any) } | |
.catch { onThrow(it) } | |
.onCompletion { onComplete() } | |
.launchIn(CoroutineScope(Job() + Dispatchers.Main)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment