rsnext/examples/with-redux-wrapper/store/tick/action.js
2020-05-18 15:24:37 -04:00

18 lines
383 B
JavaScript

export const tickActionTypes = {
TICK: 'TICK',
}
export const serverRenderClock = (isServer) => (dispatch) => {
return dispatch({
type: tickActionTypes.TICK,
light: !isServer,
ts: Date.now(),
})
}
export const startClock = () => (dispatch) => {
return setInterval(
() => dispatch({ type: tickActionTypes.TICK, light: true, ts: Date.now() }),
1000
)
}