aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/ducks/utils
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-11-09 13:01:25 +0100
committerMaximilian Hils <git@maximilianhils.com>2016-11-09 13:01:25 +0100
commit77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2 (patch)
tree8a13e6257146dc6a535dca220f7cb374cbd91a73 /web/src/js/ducks/utils
parenta0ddedff6f2e6420ab44a7763132e80a8b8075d5 (diff)
downloadmitmproxy-77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2.tar.gz
mitmproxy-77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2.tar.bz2
mitmproxy-77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2.zip
mitmweb: minor fixes
Diffstat (limited to 'web/src/js/ducks/utils')
-rw-r--r--web/src/js/ducks/utils/store.js16
1 files changed, 16 insertions, 0 deletions
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