Skip to content

Commit

Permalink
Document bound selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
devinivy committed Oct 28, 2019
1 parent 8d27c1d commit be8ea32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ Returns an uninitialized application:
- `app.store` - the redux store returned from the application's `createStore` config.
- `app.getState()` - an alias to `app.store.getState()`.
- `app.dispatch()` - an alias to `app.store.dispatch()`.
- `app.dispatch.MOD.ACTION()` - dispatches `MOD`'s action named `ACTION`, passing-along arguments to that action. Same as `app.dispatch(app.actions.MOD.ACTION())`.
- `app.dispatch.MOD.ACTION()` - dispatches `MOD`'s action named `ACTION`, passing along arguments to that action. Same as `app.dispatch(app.actions.MOD.ACTION())`.
- `app.actions.MOD.ACTION()` - an alias for `MOD`'s action named `ACTION`. Same as `app.mods.MOD.actions.ACTION()`.
- `app.select.MOD.SELECTOR()` - calls `MOD`'s selector named `SELECTOR` with the app's current state bound as the first argument and passing along additional arguments. Same as `app.mods.MOD.selectors.SELECTOR(app.getState())`.
- `app.selectors.MOD.SELECTOR()` - an alias for `MOD`'s selector named `SELECTOR`. Same as `app.mods.MOD.selectors.SELECTOR()`.

#### `middleware`
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const MiddleEnd = require('strange-middle-end');

(async () => {

const { FETCH_USER, INCREMENT } = MiddleEnd.createTypes({
const { INCREMENT, FETCH_USER } = MiddleEnd.createTypes({
INCREMENT: MiddleEnd.type.simple,
FETCH_USER: MiddleEnd.type.async
});
Expand Down Expand Up @@ -142,7 +142,7 @@ const MiddleEnd = require('strange-middle-end');

await app.dispatch.model.fetchUser({ id: 42 });

console.log(app.selectors.model.getUser(app.getState()));
console.log(app.select.model.getUser());

app.dispatch.counter.increment();

Expand Down

0 comments on commit be8ea32

Please sign in to comment.