From 1feeda4e9776df4ba0e4207fea1cfd97f41b217d Mon Sep 17 00:00:00 2001 From: Evan Schultz Date: Thu, 28 Apr 2016 13:27:14 -0400 Subject: [PATCH 1/2] npm beta bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f68edca..2a3cd14 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ng2-redux", - "version": "2.2.2-beta.2", + "version": "2.2.2-beta.3", "description": "Angular 2 bindings for Redux", "main": "./lib/index.js", "scripts": { From 01fb2821bfdcb4df61e156ae20bcf276cb9b78f9 Mon Sep 17 00:00:00 2001 From: Evan Schultz Date: Thu, 28 Apr 2016 15:00:18 -0400 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1e7eb57 --- /dev/null +++ b/CHANGELOG.md @@ -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(selector: string | number | symbol | ((state: RootState) => S), comparer?: (x: any, y: any) => boolean): Observable; + wrapActionCreators: (actions: any) => (dispatch: Redux.Dispatch) => Redux.ActionCreator<{}> | Redux.ActionCreatorsMapObject; + ``` + + Example use: + + ```js + import { NgRedux } from 'ng2-redux'; + // ... + export class MyComponent implements OnInit { + countByKey$: Observable; + countByFunc$: Observable; + 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>; + 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); + } +} +``` \ No newline at end of file