forked from angular-redux/platform
-
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.
feat(*): Typescript Port (angular-redux#33)
* Adds .idea (intellij IDE) to .gitignore * Ports the library to TypeScript, and adds (basic) generic support * Examples now work with Typed Stores, and Angular 2 Beta 1 * Upgraded tsd to typings * Updates/prunes dependencies adds postinstall for typings to the example * Purge typings * Fixes typings postinstall when used as a dependency * Updates typings and excludes tmp from tsconfig * Fix reflect-metadata issue * Fix counter and dev tools * Remove lib folder * Update counter to load ng2-redux from src * Update webpack config * Ports the library to TypeScript, and adds (basic) generic support * Update peer dependencies * Lock down versions * Adds redux-logger typings/dependency * Tests are now TypeScript * Remove old service code from provider.ts * Left ng-redux.ts as own file * Fix exports from src/index.ts * Remove extra 'reflect-metadata' from counter example * chore(tests) Add typings for mocha and chai * add chai to dev dep * update node version for tests * Observable Store and official redux typings * Remove js version of connector spec * Add ability to provide a custom compare function to .select * Fix path to index.d.ts * Update contributors on package.json * Cleanup example * Update readme with .select details * Change provider to use NgRedux class directly * Add alias for @Inject('ngRedux') To prevent breaking changes from people using @Inject('ngRedux'), setup an alias so that code using this style of injection will still work. * refactor(connector) Merge ng-redux and connector Refactored connector so all of the ng-redux.ts functionality was moved into it, then renamed it. * Updated tests, and cleaned up the provide factory. * Fix type issue for action creator * chore(readme) Update bootstrap * No longer need to register NgRedux directly as a provider * docs(ngRedux): Add docs to public api methods (angular-redux#35) * chore(package): Update repo details (angular-redux#36) * chore(ci): Setup circleci (angular-redux#37) * chore(ci): Setup circleci * chore(ci): Change badge to be circleci (angular-redux#38) * Chore ci changes (angular-redux#39) * chore(ci): remove .travis.yml * chore(ci): Change node version * Chore/example project cleanup (angular-redux#52) * chore(example): use npm package instead of source. * Prefer the chrome extension dev tools in README (angular-redux#50) This is because they don't require a dependency on React. Also showed an example of enabling Angular 2 to refresh after events fired by the dev tools. * Dependency cleanup, minor corrections to example devtools. (angular-redux#55) * Core changelog (angular-redux#53) * add changelog
- Loading branch information
Showing
47 changed files
with
1,021 additions
and
2,436 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"stage": 0, | ||
"loose": "all" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,12 @@ | ||
node_modules/ | ||
lib/ | ||
*.tgz | ||
examples/counter/dist/components/* | ||
examples/counter/dist/containers/* | ||
examples/counter/dist/index.* | ||
examples/counter/dist/index.* | ||
.idea | ||
npm-debug.log | ||
examples/counter/typings/ | ||
src/typings/ | ||
typings/ | ||
tmp/ | ||
lib/ |
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
src | ||
test | ||
examples | ||
examples | ||
.travis.yml | ||
.gitignore | ||
.babelrc | ||
lib/___tests___ |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# 2.2.2 | ||
|
||
### Features | ||
|
||
* **type definitions**: | ||
* Ported to typescript | ||
* Supports typed stores / reducers | ||
* Uses offical Redux type definitions | ||
* **Type Injectable**: | ||
* Able to inject `NgRedux` into your component by type, and not need `@Inject('ngRedux')` | ||
* `@Inject('ngRedux')` still works | ||
|
||
```ts | ||
import { NgRedux } from 'ng2-redux'; | ||
// ... | ||
export class MyComponent { | ||
constructor(private ngRedux: NgRedux) { | ||
} | ||
} | ||
``` | ||
* **State as Observable**: Ability to expose parts of your state as an observable. | ||
|
||
```ts | ||
select<S>(selector: string | number | symbol | ((state: RootState) => S), comparer?: (x: any, y: any) => boolean): Observable<S>; | ||
wrapActionCreators: (actions: any) => (dispatch: Redux.Dispatch<any>) => Redux.ActionCreator<{}> | Redux.ActionCreatorsMapObject; | ||
``` | ||
|
||
Example use: | ||
|
||
```js | ||
import { NgRedux } from 'ng2-redux'; | ||
// ... | ||
export class MyComponent implements OnInit { | ||
countByKey$: Observable<number>; | ||
countByFunc$: Observable<number>; | ||
constructor(private ngRedux: NgRedux) { | ||
} | ||
ngOnInit() { | ||
this.countByKey$ = this.ngRedux.select('count'); | ||
this.countByFunc$ = this.ngRedux.select(state=>state.count); | ||
} | ||
} | ||
``` | ||
|
||
Also have the ability to provide a custom compare function. | ||
|
||
```js | ||
import { is, Map } from 'immutable'; | ||
import { NgRedux } from 'ng2-redux'; | ||
// ... | ||
export class MyComponent implements OnInit { | ||
person$: Observable<Map<string,any>>; | ||
constructor(private ngRedux: ngRedux) { } | ||
ngOnInit() { | ||
// even if the reference of the object has changed, | ||
// if the data is the same - it wont be treated as a change | ||
this.person$ = this.ngRedux.select(state=>state.people.get(0),is); | ||
} | ||
} | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
machine: | ||
node: | ||
version: 4.4.3 |
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.