<@U0BNGCVCK|deviant> uploaded a file: <callbacks t...
# coroutines
d
@User uploaded a file: callbacks to coroutines and commented: Hi guys! I'm trying to wrap legacy callbacks code from rxjava wrappers into coroutines wrappers 🙂 And faced some problems (see attached pseudo example): 1. The yield function doesn't work inside of callback method, so i decided to use channels (line 35). It seems work ok, but i curious if there is more elegant way? 2. Not sure how to discard listeners on Cancellation exception. rxjava has convenient method setCancellable(()->Unit) for this. Should i use try/catch and remove listeners in the catch? (see line 51) 3. what difference between Channel.send() and Channel.offer()? I see that send() is a corutine. But offer() can be used outside of coroutine. Is there any best practices?