-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
162 additions
and
134 deletions.
There are no files selected for viewing
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
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
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
20 changes: 20 additions & 0 deletions
20
presentation/src/main/kotlin/clean/news/presentation/model/StoreModel.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package clean.news.presentation.model | ||
|
||
import redux.Reducer | ||
import redux.Store | ||
import redux.Store.Subscriber | ||
|
||
abstract class StoreModel<S : Any> : Store<S> { | ||
|
||
private val store by lazy { createStore() } | ||
|
||
abstract fun createStore(): Store<S> | ||
|
||
override fun getState() = store.getState() | ||
|
||
override fun replaceReducer(reducer: Reducer<S>) = store.replaceReducer(reducer) | ||
|
||
override fun subscribe(subscriber: Subscriber) = store.subscribe(subscriber) | ||
|
||
override fun dispatch(action: Any) = store.dispatch(action) | ||
} |
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
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
Oops, something went wrong.