Skip to content

Instantly share code, notes, and snippets.

@charlag
Created September 10, 2017 10:22
Show Gist options
  • Save charlag/951a0211590d7ea8493ffa40c2e19bc9 to your computer and use it in GitHub Desktop.
Save charlag/951a0211590d7ea8493ffa40c2e19bc9 to your computer and use it in GitHub Desktop.
private val addNewTodoEffect = Transformer<State, Event, Event> { upstream ->
upstream.ofEventType(Event.NewTodoEvent::class)
.observeOn(Schedulers.io())
.switchMap { (_, _, event) ->
db.todoDao().add(
TodoEntity(
id = 0,
text = event.text,
completed = false
)
)
Observable.empty<Event>()
}
}
@RekcahA
Copy link

RekcahA commented Sep 10, 2017

Very good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment