Skip to content

Commit 5d1878b

Browse files
committed
Merge pull request #13 from Foxandxss/cleanapp
Clean App.ts
2 parents 512c893 + 763e5c3 commit 5d1878b

File tree

1 file changed

+7
-11
lines changed
  • examples/counter/containers

1 file changed

+7
-11
lines changed

examples/counter/containers/App.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
import {Component, View, onInit, onDestroy} from 'angular2/angular2';
1+
import {Component, View, onDestroy} from 'angular2/angular2';
22
import {bindActionCreators} from 'redux';
33
import {Counter} from '../components/Counter';
44
import * as CounterActions from '../actions/CounterActions';
55
import { Inject } from 'angular2/di';
66

77
@Component({
88
selector: 'root',
9-
lifecycle: [onInit, onDestroy],
10-
bindings: []
9+
lifecycle: [onDestroy]
1110
})
1211
@View({
1312
directives: [Counter],
1413
template: `
1514
<counter [counter]="counter"
1615
[increment]="increment"
1716
[decrement]="decrement"
18-
[increment-If-Odd]="incrementIfOdd"
19-
[increment-Async]="incrementAsync">
17+
[increment-if-odd]="incrementIfOdd"
18+
[increment-async]="incrementAsync">
2019
</counter>
21-
<dev
2220
`
2321
})
2422
export default class App {
@@ -27,22 +25,20 @@ export default class App {
2725

2826
constructor( @Inject('ngRedux') ngRedux, @Inject('devTools') devTools) {
2927
devTools.start(ngRedux);
30-
this.unsubscribe = ngRedux.connect(this.mapState, this.mapDispatch)(this);
28+
this.unsubscribe = ngRedux.connect(this.mapStateToThis, this.mapDispatchToThis)(this);
3129
}
3230

33-
onInit() {}
34-
3531
onDestroy() {
3632
this.unsubscribe();
3733
}
3834

39-
mapState(state) {
35+
mapStateToThis(state) {
4036
return {
4137
counter: state.counter
4238
};
4339
}
4440

45-
mapDispatch(dispatch) {
41+
mapDispatchToThis(dispatch) {
4642
return bindActionCreators(CounterActions, dispatch);
4743
}
4844
}

0 commit comments

Comments
 (0)