1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports["default"] = reducer;
|
7 |
|
8 | var _actions = require("./actions");
|
9 |
|
10 | function initialScrollTop(props) {
|
11 | var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
12 | var action = arguments.length > 2 ? arguments[2] : undefined;
|
13 |
|
14 | if (!props.preserveScrollTop) {
|
15 | return 0;
|
16 | }
|
17 |
|
18 | return action.type === _actions.UPDATE_SCROLL_TOP ? action.scrollTop : state;
|
19 | }
|
20 |
|
21 | function startConsecutiveToggle(props, state, action) {
|
22 | return action.type === _actions.START_CONSECUTIVE_TOGGLE ? action.id : state;
|
23 | }
|
24 |
|
25 | function reducer(props) {
|
26 | var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
27 | var action = arguments.length > 2 ? arguments[2] : undefined;
|
28 | return {
|
29 | initialScrollTop: initialScrollTop(props, state.initialScrollTop, action),
|
30 | consecutiveToggleStartId: startConsecutiveToggle(props, state.consecutiveToggleStartId, action)
|
31 | };
|
32 | } |
\ | No newline at end of file |