2017-12-19 09:33:01 +00:00
|
|
|
import Reflux from 'reflux'
|
|
|
|
import Actions from '../actions/actions'
|
|
|
|
|
|
|
|
export default class StatusStore extends Reflux.Store {
|
|
|
|
constructor () {
|
|
|
|
super()
|
2018-12-17 16:34:32 +00:00
|
|
|
this.state = { counter: 0 }
|
2017-12-19 09:33:01 +00:00
|
|
|
this.listenTo(Actions.increment, this.onIncrement)
|
|
|
|
this.listenTo(Actions.decrement, this.onDecrement)
|
|
|
|
}
|
|
|
|
onIncrement () {
|
2018-12-17 16:34:32 +00:00
|
|
|
this.setState({ counter: this.state.counter + 1 })
|
2017-12-19 09:33:01 +00:00
|
|
|
}
|
|
|
|
onDecrement () {
|
2018-12-17 16:34:32 +00:00
|
|
|
this.setState({ counter: this.state.counter - 1 })
|
2017-12-19 09:33:01 +00:00
|
|
|
}
|
|
|
|
}
|