update README

typescript
Yanick Champoux 2019-10-20 09:52:39 -04:00
parent 3ea7863d5a
commit f5c5728ede
1 changed files with 15 additions and 11 deletions

View File

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