From 77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 9 Nov 2016 13:01:25 +0100 Subject: mitmweb: minor fixes --- web/src/js/ducks/utils/store.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'web/src/js/ducks/utils/store.js') diff --git a/web/src/js/ducks/utils/store.js b/web/src/js/ducks/utils/store.js index 3252d697..9ea4f02e 100644 --- a/web/src/js/ducks/utils/store.js +++ b/web/src/js/ducks/utils/store.js @@ -13,6 +13,22 @@ const defaultState = { viewIndex: {}, } +/** + * The store reducer can be used as a mixin to another reducer that always returns a + * new { byId, list, listIndex, view, viewIndex } object. The reducer using the store + * usually has to map its action to the matching store action and then call the mixin with that. + * + * Example Usage: + * + * import reduceStore, * as storeActions from "./utils/store" + * + * case EVENTLOG_ADD: + * return { + * ...state, + * ...reduceStore(state, storeActions.add(action.data)) + * } + * + */ export default function reduce(state = defaultState, action) { let { byId, list, listIndex, view, viewIndex } = state -- cgit v1.2.3