diff options
Diffstat (limited to 'app/javascript/vehicle_journeys/batch.js')
| -rw-r--r-- | app/javascript/vehicle_journeys/batch.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/javascript/vehicle_journeys/batch.js b/app/javascript/vehicle_journeys/batch.js new file mode 100644 index 000000000..ea08572aa --- /dev/null +++ b/app/javascript/vehicle_journeys/batch.js @@ -0,0 +1,26 @@ +// 'use strict'; + +// Object.defineProperty(exports, "__esModule", { +// value: true +// }); +// exports.batchActions = batchActions; +// exports.enableBatching = enableBatching; +// var BATCH = exports.BATCH = 'BATCH'; + +export function batchActions(actions) { + return { + type: 'BATCH', + payload: actions + }; +} + +export function enableBatching(reduce) { + return function batchingReducer(state, action) { + switch (action.type) { + case 'BATCH': + return action.payload.reduce(batchingReducer, state); + default: + return reduce(state, action); + } + } +}
\ No newline at end of file |
