forked from angular-redux/store
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds @substore decorator (angular-redux#412)
This allows for a more declarative use of the ['fractal store' feature](https://github.com/angular-redux/store/blob/master/articles/fractal-store.md) introduced in v6.3.0. Sticking a `@WithSubStore` decorator on a component or service will modify the behaviour of any `@select, @select$, or @dispatch` invocations in instances of that class: ```typescript @WithSubStore({ basePathMethodName: 'getBasePath', localReducer: localReducerFunction, }) @component({ /* ... */ }) class MyFractalComponent { @input() componentId; // Will only be called with the first non-nil value of this.componentId. Subsequent changes to the // input will be ignored. getBasePath() { return [ 'some', 'redux', 'path', this.componentId ]; } // Gets an observable to 'some.redux.path.${this.componentId}.foo' // Under the hood: // ngRedux.configureSubStore( // ['some', 'redux' 'path', this.componentId], // localReducerFunction)).select('foo') @select() foo$: Observable<String>; // Calls substore.dispatch() instead of NgRedux.instance.dispatch(). @dispatch() myAction = () => ({ type: 'MINE' }); } ```
- Loading branch information
1 parent
c79261b
commit d3470c3
Showing
45 changed files
with
3,391 additions
and
455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
// Use IntelliSense to learn about possible Node.js debug attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Unit Tests", | ||
"program": "${workspaceRoot}/tests.js" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.