Sha256: 8de861fe4ab6aa6359d24840dcc401eca3fc9c0ad651fa8a7f571c1e63021366

Contents?: true

Size: 640 Bytes

Versions: 3

Compression:

Stored size: 640 Bytes

Contents

import * as types from '../constants/ActionTypes'

export function change(counter) {
  return {
    type: types.CHANGE_COUNTER,
    counter
  }
}

export function increment() {
  return {
    type: types.INCREMENT_COUNTER
  }
}

export function decrement() {
  return {
    type: types.DECREMENT_COUNTER
  }
}

export function incrementIfOdd() {
  return (dispatch, getState) => {
    const { counter } = getState()

    if (counter % 2 === 0) {
      return
    }

    dispatch(increment())
  }
}

export function incrementAsync(delay = 1000) {
  return dispatch => {
    setTimeout(() => {
      dispatch(increment())
    }, delay)
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bouquet-0.2.2 store/private/static/app/actions/CounterActions.js
bouquet-0.2.1 store/private/static/app/actions/CounterActions.js
bouquet-0.2.0 store/private/static/app/actions/CounterActions.js