update README
This commit is contained in:
parent
3ea7863d5a
commit
f5c5728ede
26
README.md
26
README.md
@ -30,16 +30,27 @@ const {
|
|||||||
middleware,
|
middleware,
|
||||||
createStore,
|
createStore,
|
||||||
} = updux({
|
} = updux({
|
||||||
initial: {},
|
initial: {
|
||||||
|
counter: 0,
|
||||||
|
},
|
||||||
subduxes: {
|
subduxes: {
|
||||||
otherUpdux,
|
otherUpdux,
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
inc: ( increment = 1 ) => u({counter: s => s + increment })
|
||||||
},
|
},
|
||||||
effects: {
|
effects: {
|
||||||
|
'*' => api => next => action => {
|
||||||
|
console.log( "hey, look, an action zoomed by!", action );
|
||||||
|
next(action);
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
})
|
});
|
||||||
|
|
||||||
|
const store = createStore();
|
||||||
|
|
||||||
|
store.dispatch.inc(3);
|
||||||
```
|
```
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
@ -244,10 +255,6 @@ store.dispatch.addTodo(...);
|
|||||||
store.dispatch( actions.addTodo(...) );
|
store.dispatch( actions.addTodo(...) );
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Example
|
# Example
|
||||||
|
|
||||||
#### battle.js
|
#### battle.js
|
||||||
@ -260,7 +267,7 @@ import log from './log';
|
|||||||
import bogeys from './bogeys';
|
import bogeys from './bogeys';
|
||||||
|
|
||||||
const { createStore } = updux({
|
const { createStore } = updux({
|
||||||
reducers: { game, log, bogeys }
|
subduxes: { game, log, bogeys }
|
||||||
})
|
})
|
||||||
|
|
||||||
export default createStore;
|
export default createStore;
|
||||||
@ -276,7 +283,6 @@ import u from 'updeep';
|
|||||||
|
|
||||||
import { calculateMovement } from 'game/rules';
|
import { calculateMovement } from 'game/rules';
|
||||||
|
|
||||||
|
|
||||||
export default updux({
|
export default updux({
|
||||||
initial: { game: "", players: [], turn: 0, },
|
initial: { game: "", players: [], turn: 0, },
|
||||||
mutations: {
|
mutations: {
|
||||||
@ -305,13 +311,12 @@ export default updux({
|
|||||||
|
|
||||||
#### log.js
|
#### log.js
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
import { updux } from 'updux';
|
import { updux } from 'updux';
|
||||||
|
|
||||||
export default updux({
|
export default updux({
|
||||||
initial: [],
|
initial: [],
|
||||||
actions: {
|
mutations: {
|
||||||
'*': (payload,action) => state => [ ...state, action ],
|
'*': (payload,action) => state => [ ...state, action ],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -353,6 +358,5 @@ battle.dispatch.play_game();
|
|||||||
|
|
||||||
|
|
||||||
[Redux]: https://redux.js.org
|
[Redux]: https://redux.js.org
|
||||||
[rematch]: https://rematch.github.io
|
|
||||||
[Updeep]: https://github.com/substantial/updeep
|
[Updeep]: https://github.com/substantial/updeep
|
||||||
[VueX]: https://vuex.vuejs.org/
|
[VueX]: https://vuex.vuejs.org/
|
||||||
|
Loading…
Reference in New Issue
Block a user