Alexey Demedeckiy
06/13/2020, 6:59 PMclass Store {
private val channel = Channel<Action>()
suspend func dispatch(action: Action) {
channel.send(action)
}
init {
GlobalScope.launch {
for (action in channel) {
reduce(action)
notifyObservers()
}
}
}
}
Sadly, this code doesn't work - actions are not reducer.
Small detail: If i will explicitly set Dispatchers.Main in init and in dispatch - it work, but defeats my purpose.
My goal is to move action processing of main thread. notifyObservers
will build Props
for each active ViewModel
and publish.Hanno
06/14/2020, 10:09 PMNicolas Chevalier
06/15/2020, 1:46 PM