Joost de Vries
05/17/2019, 9:17 AMswitchMap
where showing search results while the user is typing. And I want to cancel all the previous requests to the server, just have the last one. In RxJs you use switchMap
for that. What's the coroutine equivalent?pawegio
05/17/2019, 9:30 AMconcatMap
you can:
while(true) {
userTypes.awaitFirst() //suspend fun
showResult()
}
but switchMap
might require launching coroutine in parallel and keeping reference to job to cancel it.Joost de Vries
05/17/2019, 9:40 AMconcatMap
would wait for the previous result. But I don't want to do that: if there's a new event I want to cancel processing of the previous.simon.vergauwen
05/17/2019, 9:41 AMsimon.vergauwen
05/17/2019, 9:42 AMJoost de Vries
05/17/2019, 9:44 AMJoost de Vries
05/17/2019, 11:32 AMsimon.vergauwen
05/17/2019, 11:32 AM