Skip to content

Commit 47e4d54

Browse files
Patrick Jacksonpatjackson52
Patrick Jackson
authored andcommitted
update references to createStore to createThreadSafeStore
1 parent 093d26c commit 47e4d54

File tree

16 files changed

+22
-19
lines changed

16 files changed

+22
-19
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Using a function:
9999
}
100100
```
101101

102-
Using the convinence helper function `middleware`:
102+
Using the convenience helper function `middleware`:
103103
```
104104
val loggingMiddleware = middleware { store, next, action ->
105105
//log here
@@ -109,7 +109,7 @@ Using the convinence helper function `middleware`:
109109

110110
__Create a store__
111111
```
112-
val store = createStore(reducer, AppState(user, listOf()), applyMiddleware(loggingMiddleware))
112+
val store = createThreadSafeStore(reducer, AppState(user, listOf()), applyMiddleware(loggingMiddleware))
113113
```
114114

115115
You then will have access to dispatch and subscribe functions from the `store`.

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ allprojects {
2525
jcenter()
2626
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
2727
maven { url "https://dl.bintray.com/spekframework/spek-dev" }
28+
mavenCentral()
2829
}
2930

3031
group = GROUP

examples/counter/android/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ dependencies {
4040
implementation(Libs.appcompat)
4141

4242
implementation(project(":examples:counter:common"))
43-
implementation(project(":lib"))
43+
implementation(project(":lib-threadsafe"))
4444
}

examples/counter/android/src/main/java/org/reduxkotlin/example/counter/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import android.os.Handler
55
import androidx.appcompat.app.AppCompatActivity
66
import kotlinx.android.synthetic.main.activity_main.*
77
import org.reduxkotlin.StoreSubscription
8-
import org.reduxkotlin.createStore
8+
import org.reduxkotlin.createThreadSafeStore
99
import org.reduxkotlin.examples.counter.Decrement
1010
import org.reduxkotlin.examples.counter.Increment
1111
import org.reduxkotlin.examples.counter.reducer
@@ -16,7 +16,7 @@ import org.reduxkotlin.examples.counter.reducer
1616
*/
1717

1818

19-
val store = createStore(reducer, 0)
19+
val store = createThreadSafeStore(reducer, 0)
2020

2121
class MainActivity: AppCompatActivity() {
2222
lateinit var storeSubscription: StoreSubscription

examples/todos/android/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ dependencies {
4343
implementation(Libs.recyclerView)
4444

4545
implementation(project(":examples:todos:common"))
46-
implementation(project(":lib"))
46+
implementation(project(":lib-threadsafe"))
4747
}

examples/todos/android/src/main/java/org/reduxkotlin/example/todos/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import android.os.Bundle
44
import androidx.appcompat.app.AppCompatActivity
55
import kotlinx.android.synthetic.main.activity_main.*
66
import org.reduxkotlin.StoreSubscription
7-
import org.reduxkotlin.createStore
7+
import org.reduxkotlin.createThreadSafeStore
88
import org.reduxkotlin.examples.todos.*
99

1010
/**
@@ -13,7 +13,7 @@ import org.reduxkotlin.examples.todos.*
1313
*/
1414

1515

16-
val store = createStore(::rootReducer, AppState())
16+
val store = createThreadSafeStore(::rootReducer, AppState())
1717

1818
class MainActivity: AppCompatActivity() {
1919
private lateinit var storeSubscription: StoreSubscription

examples/todos/common/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ kotlin {
3232
commonMain {
3333
dependencies {
3434
implementation kotlin("stdlib-common")
35-
implementation project(":lib")
35+
implementation project(":lib-threadsafe")
3636
}
3737
}
3838
commonTest {

lib/src/commonMain/kotlin/org/reduxkotlin/Definitions.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ fun <State> middleware(dispatch: (Store<State>, next: Dispatcher, action: Any) -
8484
*
8585
* val rootReducer = combineReducers(loginReducer, feedReducer)
8686
* val store = createStore(rootReducer, AppState())
87+
* **or**
88+
* val store = createThreadSafeStore(rootReducer, AppState())
8789
*/
8890
inline fun <TState, reified TAction> reducerForActionType(
8991
crossinline reducer: ReducerForActionType<TState, TAction>

website/docs/advanced/Middleware.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fun createThunkMiddleware(extraArgument: Any? = null): ThunkMiddleware =
8484
}
8585
}
8686

87-
val store = createStore(
87+
val store = createThreadSafeStore(
8888
reducer,
8989
applyMiddleware(
9090
createThunkMiddleware(),

website/docs/api/Store.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ perform side effects, or chain them to execute in a sequence, see the examples f
105105
#### Example
106106

107107
```kotlin
108-
val store = createStore(todos, AppState(list = listOf("Use Redux")))
108+
val store = createThreadSafeStore(todos, AppState(list = listOf("Use Redux")))
109109

110110
data class AddTodo(
111111
val text: String

website/docs/api/applyMiddleware.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ maybe not calling it at all. The last middleware in the chain will receive the r
4646
```kotlin
4747
typealias StoreEnhancer<State> = (StoreCreator<State>) -> StoreCreator<State>
4848
```
49-
but the easiest way to apply it is to pass it to [`createStore()`](./createStore.md) as the last
49+
but the easiest way to apply it is to pass it to [`createThreadSafeStore()`](./createStore.md) as the last
5050
`enhancer` argument.
5151

5252
#### Example: Custom Logger Middleware
@@ -67,7 +67,7 @@ fun loggerMiddleware2(store: Store<AppState>) = { next: Dispatcher ->
6767
}
6868

6969

70-
val store = createStore(todos, AppState.INITIAL_STATE, applyMiddleware(::logger))
70+
val store = createThreadSafeStore(todos, AppState.INITIAL_STATE, applyMiddleware(::logger))
7171

7272
store.dispatch(AddTodoAction(text = "Understand middleware"))
7373
// (These lines will be logged by the middleware:)

website/docs/api/compose.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This example demonstrates how to use `compose` to enhance a [store](Store.md) wi
3030
[redux-devtools](https://github.com/reduxjs/redux-devtools) package.
3131

3232
```kotlin
33-
val store = createStore(
33+
val store = createThreadSafeStore(
3434
reducer,
3535
compose(
3636
presenterEnhancer(uiContext),

website/docs/basics/Reducers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ method is to use a `val` in the companion object of `AppState`.
9696
> parameter from the `createStore` function. ReduxKotlin requires a preloaded state to be passed to
9797
> `createStore`. This allows us to use a nonnullable type for State.
9898
```kotlin
99-
val store = createStore(reducer, INITIAL_STATE)
99+
val store = createThreadSafeStore(reducer, INITIAL_STATE)
100100
```
101101

102102
Now let's handle `SET_VISIBILITY_FILTER`. All it needs to do is to change `visibilityFilter` on the

website/docs/basics/Store.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ split your data handling logic, you'll use [reducer composition](Reducers.md#spl
2323
instead of many stores.
2424

2525
It's easy to create a store if you have a reducer. In the [previous section](Reducers.md), we
26-
combined several reducers into one. We will now pass it to [`createStore()`](../api/createStore.md).
26+
combined several reducers into one. We will now pass it to [`createThreadSafeStore()`](../api/createStore.md).
2727

2828
```kotlin
29-
val store = createStore(todoAppReducer, INITIAL_STATE)
29+
val store = createThreadSafeStore(todoAppReducer, INITIAL_STATE)
3030
```
3131

3232
> ##### Note on required initial state

website/docs/introduction/GettingStarted.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Decrement
9191

9292
// Create a Redux store holding the state of your app.
9393
// 0 is the initial state
94-
val store = createStore(reducer, 0)
94+
val store = createThreadSafeStore(reducer, 0)
9595

9696
// You can use subscribe() to update the UI in response to state changes.
9797
// Normally you'd use an additional layer or view binding library rather than subscribe() directly.

website/docs/introduction/ThreePrinciples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fun rootReducer(state: AppState, action: Any) = AppState(
8181
visibilityFilter = visibilityFilterReducer(state.visibilityFilter, action)
8282
)
8383

84-
val store = createStore(::rootReducer, AppState.INITIAL_STATE)
84+
val store = createThreadSafeStore(::rootReducer, AppState.INITIAL_STATE)
8585
```
8686

8787
That's it! Now you know what Redux is all about.

0 commit comments

Comments
 (0)