Skip to content

Instantly share code, notes, and snippets.

@itome
Created January 11, 2019 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itome/7da1d67790b5c9af9ccbd3f98c601446 to your computer and use it in GitHub Desktop.
Save itome/7da1d67790b5c9af9ccbd3f98c601446 to your computer and use it in GitHub Desktop.
class CounterProcessor : Processor<CounterAction>() {
private fun processIncrementAction(action: DelayedIncrementAction) = launch {
delay(1000)
put(UpdateCountAction(action.count - 1))
}
override fun processAction(action: CounterAction) {
when (action) {
is IncrementAction -> processIncrementAction(action)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment