From 6c0511b06fdc359ec4c48879f803c80d7fbeb34c Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 18 Jun 2016 14:11:42 +0800 Subject: [web] add app ducks --- web/src/js/ducks/app.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 web/src/js/ducks/app.js (limited to 'web/src/js/ducks/app.js') diff --git a/web/src/js/ducks/app.js b/web/src/js/ducks/app.js new file mode 100644 index 00000000..f1dcb490 --- /dev/null +++ b/web/src/js/ducks/app.js @@ -0,0 +1,27 @@ +import { connect as wsConnect, disconnect as wsDisconnect } from './websocket' + +export const INIT = 'APP_INIT' + +const defaultState = {} + +export function reduce(state = defaultState, action) { + switch (action.type) { + + default: + return state + } +} + +export function init() { + return dispatch => { + dispatch(wsConnect()) + dispatch({ type: INIT }) + } +} + +export function destruct() { + return dispatch => { + dispatch(wsDisconnect()) + dispatch({ type: DESTRUCT }) + } +} -- cgit v1.2.3