Created
September 5, 2020 20:39
-
-
Save GianpaMX/e06080f6affb8abd9aa5da2ca0948ee5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class ClockViewModel @Inject constructor( | |
observeState: ObserveState, | |
private val nextState: NextState, | |
private val errorChannel: BroadcastChannel<Throwable>, | |
private val defaultDispatcher: CoroutineDispatcher | |
) : ViewModel() { | |
val viewState: LiveData<ClockViewState> = observeState() | |
.map { it.toViewState() } | |
.flowOn(defaultDispatcher) | |
.catch { errorChannel.send(it) } | |
.asLiveData(viewModelScope.coroutineContext) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment