Last active
April 25, 2018 18:24
-
-
Save CesarValiente/7c95480bc487c9551abad9cdb73a5245 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PersistenceSideEffect(val store: Store, | |
persistenceThread: ThreadExecutor? = null): SideEffect(persistenceThread) { | |
init { | |
store.sideEffects.add(this) | |
} | |
override fun handle(action: Action) { | |
when (action) { | |
is CreationAction -> CreationHandler.handle(action) { store.dispatch(it) } | |
is UpdateAction -> UpdateHandler.handle(action) { store.dispatch(it) } | |
is ReadAction -> ReadHandler.handle(action) { store.dispatch(it) } | |
is DeleteAction -> DeleteHandler.handle(action) { store.dispatch(it) } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment