Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
rename setReducer to add Reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Aug 19, 2016
1 parent 323d266 commit bce5e33
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* [model.selector(name, ...fns, fn, options)](#modelselectorname-fns-fn-options)
* [model.select(name, ...args)](#modelselectname-args)
* [model.effect(fn)](#modeleffectfn)
* [model.setReducer(fn)](#modelsetreducerfn)
* [model.addReducer(fn)](#modeladdreducerfn)
* [model.getState()](#modelgetstate)
* [`effects API`](#effects-api)
* [`effects helper API`](#effects-helper-api)
Expand Down Expand Up @@ -308,7 +308,7 @@ model.effect(function* {
})
```

### `model.setReducer(fn)`
### `model.addReducer(fn)`

Add a exists reducer to model. This is useful when you work with third party libraries or you legacy codes.

Expand Down
4 changes: 2 additions & 2 deletions src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function model(options) {
return _namespace
}

function setReducer(reducer) {
function addReducer(reducer) {
_reducers.push(reducer)
return reducer
}
Expand Down Expand Up @@ -215,7 +215,7 @@ function model(options) {
select,
effect,
getNamespace,
setReducer,
addReducer,
getReducer,
getEffect,
getState,
Expand Down
2 changes: 1 addition & 1 deletion src/models/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const routing = model({
namespace: 'routing',
})

routing.setReducer(routerReducer)
routing.addReducer(routerReducer)

export default routing
4 changes: 2 additions & 2 deletions test/model.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ test('define multiple reducers', t => {
on(counter.add2, state => state + 2)
})

counter.setReducer((state, { type }) => {
counter.addReducer((state, { type }) => {
switch (type) {
case counter.add3.getType():
return state + 3
Expand All @@ -142,7 +142,7 @@ test('define multiple reducers', t => {
}
})

counter.setReducer((state, { type }) => {
counter.addReducer((state, { type }) => {
switch (type) {
case counter.add4.getType():
return state + 4
Expand Down

0 comments on commit bce5e33

Please sign in to comment.