louiscad
02/28/2018, 1:36 PMReceiveChannel
/ actor that cancels the work done for a value if a new one is received? My goal is to perform a computation for the latest received value and drop any in progress work.Jonathan
02/28/2018, 1:38 PMval actor = actor<Int> {
var job: Job? = null
consumeEach {
job?.cancel()
job = launch(coroutineContext) {
// TODO
}
}
}
louiscad
02/28/2018, 1:55 PM