├── .eslintignore ├── docs ├── _config.yml ├── reducer.png └── index.md ├── .travis.yml ├── example-state.png ├── .npmignore ├── .babelrc ├── src ├── index.js ├── actions.js ├── middleware.js └── reducer.js ├── examples └── basic │ ├── package.json │ ├── store.js │ ├── index.js │ ├── index.html │ └── dist │ ├── index.html │ ├── basic.js │ └── basic.map ├── lib ├── index.js ├── actions.js ├── middleware.js └── reducer.js ├── .eslintrc.json ├── LICENSE ├── .gitignore ├── package.json ├── test ├── actions.spec.js ├── middleware.spec.js └── reducer.spec.js └── README.md /.eslintignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman 2 | show_downloads: true 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - "node" 5 | 6 | cache: yarn 7 | -------------------------------------------------------------------------------- /docs/reducer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nishanbajracharya/redux-loader/HEAD/docs/reducer.png -------------------------------------------------------------------------------- /example-state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nishanbajracharya/redux-loader/HEAD/example-state.png -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | examples/ 2 | src/ 3 | test/ 4 | .babelrc 5 | .eslintignore 6 | .eslintrc.json 7 | yarn.lock 8 | .gitignore 9 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "env" 4 | ], 5 | "plugins": [ 6 | "transform-object-rest-spread" 7 | ], 8 | "env": { 9 | "test": { 10 | "presets": [["env"]] 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import reduxLoaderReducer from './reducer'; 2 | import reduxLoaderActions from './actions'; 3 | import reduxLoaderMiddleware from './middleware'; 4 | 5 | export { reduxLoaderActions, reduxLoaderReducer, reduxLoaderMiddleware }; 6 | 7 | export default { actions: reduxLoaderActions, reducer: reduxLoaderReducer, middleware: reduxLoaderMiddleware }; 8 | -------------------------------------------------------------------------------- /examples/basic/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "basic", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "parcel index.html", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "devDependencies": { 14 | "babel-core": "^6.26.3", 15 | "parcel-bundler": "^1.6.2" 16 | }, 17 | "dependencies": { 18 | "redux": "^3.7.2" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/basic/store.js: -------------------------------------------------------------------------------- 1 | import { applyMiddleware, createStore, compose, combineReducers } from 'redux'; 2 | 3 | import { reduxLoaderReducer, reduxLoaderMiddleware } from '../../lib'; 4 | 5 | const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; 6 | const enhancer = composeEnhancers(applyMiddleware(reduxLoaderMiddleware())); 7 | 8 | const reducer = combineReducers({ 9 | reduxLoader: reduxLoaderReducer, 10 | }); 11 | 12 | const store = createStore(reducer, enhancer); 13 | 14 | export default store; 15 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.reduxLoaderMiddleware = exports.reduxLoaderReducer = exports.reduxLoaderActions = undefined; 7 | 8 | var _reducer = require('./reducer'); 9 | 10 | var _reducer2 = _interopRequireDefault(_reducer); 11 | 12 | var _actions = require('./actions'); 13 | 14 | var _actions2 = _interopRequireDefault(_actions); 15 | 16 | var _middleware = require('./middleware'); 17 | 18 | var _middleware2 = _interopRequireDefault(_middleware); 19 | 20 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 21 | 22 | exports.reduxLoaderActions = _actions2.default; 23 | exports.reduxLoaderReducer = _reducer2.default; 24 | exports.reduxLoaderMiddleware = _middleware2.default; 25 | exports.default = { actions: _actions2.default, reducer: _reducer2.default, middleware: _middleware2.default }; -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "commonjs": true, 5 | "es6": true, 6 | "jest": true 7 | }, 8 | "extends": "eslint:recommended", 9 | "parserOptions": { 10 | "ecmaFeatures": { 11 | "experimentalObjectRestSpread": true, 12 | "jsx": true 13 | }, 14 | "sourceType": "module" 15 | }, 16 | "plugins": [ 17 | "react" 18 | ], 19 | "rules": { 20 | "indent": [ 21 | "error", 22 | 2, 23 | { 24 | "SwitchCase": 1 25 | } 26 | ], 27 | "linebreak-style": [ 28 | "error", 29 | "unix" 30 | ], 31 | "quotes": [ 32 | "error", 33 | "single" 34 | ], 35 | "semi": [ 36 | "error", 37 | "always" 38 | ], 39 | "comma-dangle": [ 40 | "error", 41 | { 42 | "arrays": "never", 43 | "imports": "never", 44 | "exports": "never", 45 | "functions": "ignore", 46 | "objects": "always-multiline" 47 | } 48 | ] 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/actions.js: -------------------------------------------------------------------------------- 1 | export const STOP_LOADING = '@@RL/STOP_LOADING'; 2 | export const START_LOADING = '@@RL/START_LOADING'; 3 | export const REGISTER_LOADER = '@@RL/REGISTER_LOADER'; 4 | export const UNREGISTER_LOADER = '@@RL/UNREGISTER_LOADER'; 5 | 6 | export const stopLoading = id => ({ 7 | type: STOP_LOADING, 8 | payload: id, 9 | }); 10 | 11 | export const startLoading = id => ({ 12 | type: START_LOADING, 13 | payload: id, 14 | }); 15 | 16 | export const registerLoader = ({ 17 | id, 18 | stopActions, 19 | startActions, 20 | }) => ({ 21 | type: REGISTER_LOADER, 22 | payload: { 23 | id, 24 | stopActions, 25 | startActions, 26 | }, 27 | }); 28 | 29 | export const unregisterLoader = id => ({ 30 | type: UNREGISTER_LOADER, 31 | payload: id, 32 | }); 33 | 34 | export default { 35 | // Actions 36 | STOP_LOADING, 37 | START_LOADING, 38 | REGISTER_LOADER, 39 | UNREGISTER_LOADER, 40 | 41 | // Action creators 42 | stopLoading, 43 | startLoading, 44 | registerLoader, 45 | unregisterLoader, 46 | }; 47 | -------------------------------------------------------------------------------- /src/middleware.js: -------------------------------------------------------------------------------- 1 | import actions from './actions'; 2 | 3 | const DEFAULT_REDUCER = 'reduxLoader'; 4 | 5 | const middleware = (key = DEFAULT_REDUCER) => store => next => action => { 6 | const state = store.getState()[key]; 7 | 8 | if (state) { 9 | next(action); 10 | 11 | const startActions = state.startActions || {}; 12 | const startActionTypes = Object.keys(startActions); 13 | 14 | const stopActions = state.stopActions || {}; 15 | const stopActionTypes = Object.keys(stopActions); 16 | 17 | if (startActionTypes.includes(action.type)) { 18 | const id = startActions[action.type]; 19 | 20 | return next({ 21 | type: actions.START_LOADING, 22 | payload: id, 23 | }); 24 | } 25 | 26 | if (stopActionTypes.includes(action.type)) { 27 | const id = stopActions[action.type]; 28 | 29 | return next({ 30 | type: actions.STOP_LOADING, 31 | payload: id, 32 | }); 33 | } 34 | 35 | return; 36 | } 37 | 38 | return next(action); 39 | }; 40 | 41 | export default middleware; 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Nishan Bajracharya 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # Parcel cache 61 | .cache 62 | 63 | # Bundle 64 | dist/ -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "redux-state-loader", 3 | "version": "0.1.6", 4 | "description": "A redux middleware to handle loading states triggered through start, success and failure actions.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "test": "jest", 8 | "lint": "eslint src/", 9 | "clean": "del lib", 10 | "prebuild": "npm run clean", 11 | "build": "babel src -d lib", 12 | "lint:fix": "eslint --fix src/" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/nishanbajracharya/redux-loader.git" 17 | }, 18 | "keywords": [ 19 | "redux", 20 | "middleware" 21 | ], 22 | "author": "Nishan Bajracharya ", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/nishanbajracharya/redux-loader/issues" 26 | }, 27 | "homepage": "https://github.com/nishanbajracharya/redux-loader#readme", 28 | "devDependencies": { 29 | "babel-cli": "^6.26.0", 30 | "babel-core": "^6.26.3", 31 | "babel-plugin-transform-object-rest-spread": "^6.26.0", 32 | "babel-preset-env": "^1.6.1", 33 | "del-cli": "^1.1.0", 34 | "eslint": "^4.19.0", 35 | "eslint-plugin-react": "^7.7.0", 36 | "jest": "^22.4.2" 37 | }, 38 | "peerDependencies": { 39 | "redux": "^3.7.2" 40 | }, 41 | "dependencies": {} 42 | } 43 | -------------------------------------------------------------------------------- /test/actions.spec.js: -------------------------------------------------------------------------------- 1 | import * as actions from '../src/actions'; 2 | 3 | it('should return register action', () => { 4 | const expectedAction = { 5 | type: actions.REGISTER_LOADER, 6 | payload: { 7 | id: 'myLoader', 8 | startActions: 'DUMMY_START_ACTION', 9 | stopActions: 'DUMMY_SUCCESS_ACTION', 10 | }, 11 | }; 12 | 13 | const action = actions.registerLoader({ 14 | id: 'myLoader', 15 | startActions: 'DUMMY_START_ACTION', 16 | stopActions: 'DUMMY_SUCCESS_ACTION', 17 | }); 18 | 19 | expect(action).toEqual(expectedAction); 20 | }); 21 | 22 | it('should return unregister action', () => { 23 | const expectedAction = { 24 | type: actions.UNREGISTER_LOADER, 25 | payload: 'myLoader', 26 | }; 27 | 28 | const action = actions.unregisterLoader('myLoader'); 29 | 30 | expect(action).toEqual(expectedAction); 31 | }); 32 | 33 | it('should return start loading action', () => { 34 | const expectedAction = { 35 | type: actions.START_LOADING, 36 | payload: ['myLoader'], 37 | }; 38 | 39 | const action = actions.startLoading(['myLoader']); 40 | 41 | expect(action).toEqual(expectedAction); 42 | }); 43 | 44 | it('should return stop loading action', () => { 45 | const expectedAction = { 46 | type: actions.STOP_LOADING, 47 | payload: ['myLoader'], 48 | }; 49 | 50 | const action = actions.stopLoading(['myLoader']); 51 | 52 | expect(action).toEqual(expectedAction); 53 | }); 54 | -------------------------------------------------------------------------------- /lib/actions.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var STOP_LOADING = exports.STOP_LOADING = '@@RL/STOP_LOADING'; 7 | var START_LOADING = exports.START_LOADING = '@@RL/START_LOADING'; 8 | var REGISTER_LOADER = exports.REGISTER_LOADER = '@@RL/REGISTER_LOADER'; 9 | var UNREGISTER_LOADER = exports.UNREGISTER_LOADER = '@@RL/UNREGISTER_LOADER'; 10 | 11 | var stopLoading = exports.stopLoading = function stopLoading(id) { 12 | return { 13 | type: STOP_LOADING, 14 | payload: id 15 | }; 16 | }; 17 | 18 | var startLoading = exports.startLoading = function startLoading(id) { 19 | return { 20 | type: START_LOADING, 21 | payload: id 22 | }; 23 | }; 24 | 25 | var registerLoader = exports.registerLoader = function registerLoader(_ref) { 26 | var id = _ref.id, 27 | stopActions = _ref.stopActions, 28 | startActions = _ref.startActions; 29 | return { 30 | type: REGISTER_LOADER, 31 | payload: { 32 | id: id, 33 | stopActions: stopActions, 34 | startActions: startActions 35 | } 36 | }; 37 | }; 38 | 39 | var unregisterLoader = exports.unregisterLoader = function unregisterLoader(id) { 40 | return { 41 | type: UNREGISTER_LOADER, 42 | payload: id 43 | }; 44 | }; 45 | 46 | exports.default = { 47 | // Actions 48 | STOP_LOADING: STOP_LOADING, 49 | START_LOADING: START_LOADING, 50 | REGISTER_LOADER: REGISTER_LOADER, 51 | UNREGISTER_LOADER: UNREGISTER_LOADER, 52 | 53 | // Action creators 54 | stopLoading: stopLoading, 55 | startLoading: startLoading, 56 | registerLoader: registerLoader, 57 | unregisterLoader: unregisterLoader 58 | }; -------------------------------------------------------------------------------- /lib/middleware.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _actions = require('./actions'); 8 | 9 | var _actions2 = _interopRequireDefault(_actions); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | var DEFAULT_REDUCER = 'reduxLoader'; 14 | 15 | var middleware = function middleware() { 16 | var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_REDUCER; 17 | return function (store) { 18 | return function (next) { 19 | return function (action) { 20 | var state = store.getState()[key]; 21 | 22 | if (state) { 23 | next(action); 24 | 25 | var startActions = state.startActions || {}; 26 | var startActionTypes = Object.keys(startActions); 27 | 28 | var stopActions = state.stopActions || {}; 29 | var stopActionTypes = Object.keys(stopActions); 30 | 31 | if (startActionTypes.includes(action.type)) { 32 | var id = startActions[action.type]; 33 | 34 | return next({ 35 | type: _actions2.default.START_LOADING, 36 | payload: id 37 | }); 38 | } 39 | 40 | if (stopActionTypes.includes(action.type)) { 41 | var _id = stopActions[action.type]; 42 | 43 | return next({ 44 | type: _actions2.default.STOP_LOADING, 45 | payload: _id 46 | }); 47 | } 48 | 49 | return; 50 | } 51 | 52 | return next(action); 53 | }; 54 | }; 55 | }; 56 | }; 57 | 58 | exports.default = middleware; -------------------------------------------------------------------------------- /src/reducer.js: -------------------------------------------------------------------------------- 1 | import actions from './actions'; 2 | 3 | const omit = (obj = {}, blacklist = []) => 4 | Object.keys(obj) 5 | .filter(key => !blacklist.includes(key)) 6 | .reduce((newObj, key) => ({ ...newObj, [key]: obj[key] }), {}); 7 | 8 | 9 | const reduceArrayToObjectValue = (ids = [], status = '') => 10 | ids.reduce( 11 | (acc, id) => ({ 12 | ...acc, 13 | [id]: status, 14 | }), 15 | {} 16 | ); 17 | 18 | const INITIAL_STATE = { 19 | history: {}, 20 | loaders: {}, 21 | startActions: {}, 22 | stopActions: {}, 23 | }; 24 | 25 | const reducer = (state = INITIAL_STATE, action) => { 26 | switch (action.type) { 27 | case actions.REGISTER_LOADER: 28 | return { 29 | ...state, 30 | loaders: { ...state.loaders, [action.payload.id]: false }, 31 | startActions: {...state.startActions, ...reduceArrayToObjectValue(action.payload.startActions, action.payload.id)}, 32 | stopActions: {...state.stopActions, ...reduceArrayToObjectValue(action.payload.stopActions, action.payload.id)}, 33 | history: { 34 | ...state.history, 35 | [action.payload.id]: action.payload, 36 | }, 37 | }; 38 | case actions.UNREGISTER_LOADER: 39 | return { 40 | ...state, 41 | history: omit(state.history, action.payload), 42 | loaders: omit(state.loaders, action.payload), 43 | startActions: omit( 44 | state.startActions, 45 | state.history[action.payload].startActions 46 | ), 47 | stopActions: omit( 48 | state.stopActions, 49 | state.history[action.payload].stopActions 50 | ), 51 | }; 52 | case actions.START_LOADING: 53 | return { 54 | ...state, 55 | loaders: { ...state.loaders, [action.payload]: true }, 56 | }; 57 | case actions.STOP_LOADING: 58 | return { 59 | ...state, 60 | loaders: { ...state.loaders, [action.payload]: false }, 61 | }; 62 | default: 63 | return state; 64 | } 65 | }; 66 | 67 | export default reducer; 68 | -------------------------------------------------------------------------------- /examples/basic/index.js: -------------------------------------------------------------------------------- 1 | import store from './store'; 2 | import { reduxLoaderActions } from '../../lib'; 3 | 4 | const btn = document.querySelector('.button'); 5 | const logElem = document.querySelector('.logs'); 6 | const loading = document.querySelector('.loading'); 7 | 8 | const btn2 = document.querySelector('.button2'); 9 | const loading2 = document.querySelector('.loading2'); 10 | 11 | const log = (action, className = '') => { 12 | logElem.innerHTML += `
  • ${action.type}
  • `; 13 | }; 14 | 15 | store.subscribe(() => { 16 | if (store.getState().reduxLoader.loaders.myLoader) { 17 | loading.classList.add('show'); 18 | } else { 19 | loading.classList.remove('show'); 20 | } 21 | 22 | if (store.getState().reduxLoader.loaders.myLoader2) { 23 | loading2.classList.add('show'); 24 | } else { 25 | loading2.classList.remove('show'); 26 | } 27 | }); 28 | 29 | const registerAction = { 30 | type: reduxLoaderActions.REGISTER_LOADER, 31 | payload: { 32 | id: 'myLoader', 33 | startActions: ['SOME_ACTION_THAT_TRIGGERS_LOADING', 'ANOTHER_ACTION'], 34 | stopActions: ['SUCCESS', 'FAILURE'], 35 | }, 36 | }; 37 | 38 | const successAction = { 39 | type: 'SUCCESS', 40 | }; 41 | 42 | const failureAction = { 43 | type: 'FAILURE', 44 | }; 45 | 46 | const triggerAction = { type: 'SOME_ACTION_THAT_TRIGGERS_LOADING' }; 47 | 48 | store.dispatch(registerAction); 49 | 50 | store.dispatch({ 51 | type: reduxLoaderActions.REGISTER_LOADER, 52 | payload: { 53 | id: 'myLoader2', 54 | startActions: ['SOME_ACTION_THAT_TRIGGERS_LOADING_2', 'ANOTHER_ACTION_2'], 55 | stopActions: ['SUCCESS_2', 'FAILURE_2'], 56 | }, 57 | }); 58 | 59 | const triggerExample = (triggerAction, successAction, failureAction) => { 60 | store.dispatch(triggerAction); 61 | log(triggerAction); 62 | 63 | const success = Math.round(Math.random()); 64 | 65 | setTimeout(() => { 66 | if(success) { 67 | store.dispatch(successAction); 68 | log(successAction, 'success'); 69 | } else { 70 | store.dispatch(failureAction); 71 | log(failureAction, 'failure'); 72 | } 73 | }, 1500); 74 | }; 75 | 76 | btn.onclick = () => triggerExample(triggerAction, successAction, failureAction); 77 | 78 | btn2.onclick = () => triggerExample({ 79 | type: 'ANOTHER_ACTION_2', 80 | }, { 81 | type: 'SUCCESS_2', 82 | }, { 83 | type: 'FAILURE_2', 84 | }); 85 | -------------------------------------------------------------------------------- /test/middleware.spec.js: -------------------------------------------------------------------------------- 1 | import loader from '../src/middleware'; 2 | import * as actions from '../src/actions'; 3 | 4 | const reducer = 'reduxLoader'; 5 | const INITIAL_STATE = { 6 | [reducer]: { 7 | history: { 8 | myLoader: { 9 | id: 'myLoader', 10 | startActions: ['DUMMY_START_ACTION'], 11 | stopActions: ['DUMMY_SUCCESS_ACTION', 'DUMMY_FAILURE_ACTION'], 12 | }, 13 | }, 14 | loaders: { 15 | myLoader: false, 16 | }, 17 | startActions: { 18 | DUMMY_START_ACTION: 'myLoader', 19 | }, 20 | stopActions: { 21 | DUMMY_SUCCESS_ACTION: 'myLoader', 22 | DUMMY_FAILURE_ACTION: 'myLoader', 23 | }, 24 | }, 25 | }; 26 | 27 | const create = () => { 28 | const store = { 29 | getState: jest.fn(() => INITIAL_STATE), 30 | dispatch: jest.fn(), 31 | }; 32 | const next = jest.fn(); 33 | 34 | const invoke = (action) => loader(reducer)(store)(next)(action); 35 | 36 | return {store, next, invoke}; 37 | }; 38 | 39 | const startAction = {type: 'DUMMY_START_ACTION'}; 40 | const successAction = {type: 'DUMMY_SUCCESS_ACTION'}; 41 | const failureAction = {type: 'DUMMY_FAILURE_ACTION'}; 42 | 43 | it('should pass through non-loader actions', () => { 44 | const { next, invoke } = create(); 45 | 46 | const action = { type: 'TEST' }; 47 | 48 | invoke(action); 49 | 50 | expect(next).toHaveBeenCalledWith(action); 51 | }); 52 | 53 | it('should return start loading action', () => { 54 | const { next, invoke } = create(); 55 | 56 | invoke(startAction); 57 | 58 | const startLoadingAction = { 59 | type: actions.START_LOADING, 60 | payload: 'myLoader', 61 | }; 62 | 63 | expect(next).toHaveBeenCalledWith(startLoadingAction); 64 | }); 65 | 66 | it('should return stop loading action for success action', () => { 67 | const { next, invoke } = create(); 68 | 69 | invoke(startAction); 70 | invoke(successAction); 71 | 72 | const stopLoadingAction = { 73 | type: actions.STOP_LOADING, 74 | payload: 'myLoader', 75 | }; 76 | 77 | expect(next).toHaveBeenCalledWith(stopLoadingAction); 78 | }); 79 | 80 | it('should return stop loading action for failure action', () => { 81 | const { next, invoke } = create(); 82 | 83 | invoke(startAction); 84 | invoke(failureAction); 85 | 86 | const stopLoadingAction = { 87 | type: actions.STOP_LOADING, 88 | payload: 'myLoader', 89 | }; 90 | 91 | expect(next).toHaveBeenCalledWith(stopLoadingAction); 92 | }); 93 | -------------------------------------------------------------------------------- /lib/reducer.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; 8 | 9 | var _actions = require('./actions'); 10 | 11 | var _actions2 = _interopRequireDefault(_actions); 12 | 13 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 14 | 15 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 16 | 17 | var omit = function omit() { 18 | var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 19 | var blacklist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; 20 | return Object.keys(obj).filter(function (key) { 21 | return !blacklist.includes(key); 22 | }).reduce(function (newObj, key) { 23 | return _extends({}, newObj, _defineProperty({}, key, obj[key])); 24 | }, {}); 25 | }; 26 | 27 | var reduceArrayToObjectValue = function reduceArrayToObjectValue() { 28 | var ids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 29 | var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 30 | return ids.reduce(function (acc, id) { 31 | return _extends({}, acc, _defineProperty({}, id, status)); 32 | }, {}); 33 | }; 34 | 35 | var INITIAL_STATE = { 36 | history: {}, 37 | loaders: {}, 38 | startActions: {}, 39 | stopActions: {} 40 | }; 41 | 42 | var reducer = function reducer() { 43 | var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_STATE; 44 | var action = arguments[1]; 45 | 46 | switch (action.type) { 47 | case _actions2.default.REGISTER_LOADER: 48 | return _extends({}, state, { 49 | loaders: _extends({}, state.loaders, _defineProperty({}, action.payload.id, false)), 50 | startActions: _extends({}, state.startActions, reduceArrayToObjectValue(action.payload.startActions, action.payload.id)), 51 | stopActions: _extends({}, state.stopActions, reduceArrayToObjectValue(action.payload.stopActions, action.payload.id)), 52 | history: _extends({}, state.history, _defineProperty({}, action.payload.id, action.payload)) 53 | }); 54 | case _actions2.default.UNREGISTER_LOADER: 55 | return _extends({}, state, { 56 | history: omit(state.history, action.payload), 57 | loaders: omit(state.loaders, action.payload), 58 | startActions: omit(state.startActions, state.history[action.payload].startActions), 59 | stopActions: omit(state.stopActions, state.history[action.payload].stopActions) 60 | }); 61 | case _actions2.default.START_LOADING: 62 | return _extends({}, state, { 63 | loaders: _extends({}, state.loaders, _defineProperty({}, action.payload, true)) 64 | }); 65 | case _actions2.default.STOP_LOADING: 66 | return _extends({}, state, { 67 | loaders: _extends({}, state.loaders, _defineProperty({}, action.payload, false)) 68 | }); 69 | default: 70 | return state; 71 | } 72 | }; 73 | 74 | exports.default = reducer; -------------------------------------------------------------------------------- /test/reducer.spec.js: -------------------------------------------------------------------------------- 1 | import reducer from '../src/reducer'; 2 | import * as actions from '../src/actions'; 3 | 4 | const initialState = { 5 | history: {}, 6 | loaders: {}, 7 | stopActions: {}, 8 | startActions: {}, 9 | }; 10 | 11 | const registerAction = actions.registerLoader({ 12 | id: 'myLoader', 13 | startActions: ['DUMMY_START_ACTION'], 14 | stopActions: ['DUMMY_SUCCESS_ACTION', 'DUMMY_FAILURE_ACTION'], 15 | }); 16 | 17 | const stopLoadingAction = actions.stopLoading('myLoader'); 18 | const startLoadingAction = actions.startLoading('myLoader'); 19 | const unregisterAction = actions.unregisterLoader('myLoader'); 20 | 21 | it('should return new state with registered loader', () => { 22 | const newState = reducer(initialState, registerAction); 23 | 24 | const expectedState = { 25 | history: { 26 | myLoader: { 27 | id: 'myLoader', 28 | startActions: ['DUMMY_START_ACTION'], 29 | stopActions: ['DUMMY_SUCCESS_ACTION', 'DUMMY_FAILURE_ACTION'], 30 | }, 31 | }, 32 | loaders: { 33 | myLoader: false, 34 | }, 35 | startActions: { 36 | DUMMY_START_ACTION: 'myLoader', 37 | }, 38 | stopActions: { 39 | DUMMY_SUCCESS_ACTION: 'myLoader', 40 | DUMMY_FAILURE_ACTION: 'myLoader', 41 | }, 42 | }; 43 | 44 | expect(newState).toEqual(expectedState); 45 | }); 46 | 47 | it('should return new state with loading started', () => { 48 | const registeredState = reducer(initialState, registerAction); 49 | const newState = reducer(registeredState, startLoadingAction); 50 | 51 | const expectedState = { 52 | history: { 53 | myLoader: { 54 | id: 'myLoader', 55 | startActions: ['DUMMY_START_ACTION'], 56 | stopActions: ['DUMMY_SUCCESS_ACTION', 'DUMMY_FAILURE_ACTION'], 57 | }, 58 | }, 59 | loaders: { 60 | myLoader: true, 61 | }, 62 | startActions: { 63 | DUMMY_START_ACTION: 'myLoader', 64 | }, 65 | stopActions: { 66 | DUMMY_SUCCESS_ACTION: 'myLoader', 67 | DUMMY_FAILURE_ACTION: 'myLoader', 68 | }, 69 | }; 70 | 71 | expect(newState).toEqual(expectedState); 72 | }); 73 | 74 | it('should return new state with loading stopped', () => { 75 | const registeredState = reducer(initialState, registerAction); 76 | const loadingState = reducer(registeredState, startLoadingAction); 77 | const newState = reducer(loadingState, stopLoadingAction); 78 | 79 | const expectedState = { 80 | history: { 81 | myLoader: { 82 | id: 'myLoader', 83 | startActions: ['DUMMY_START_ACTION'], 84 | stopActions: ['DUMMY_SUCCESS_ACTION', 'DUMMY_FAILURE_ACTION'], 85 | }, 86 | }, 87 | loaders: { 88 | myLoader: false, 89 | }, 90 | startActions: { 91 | DUMMY_START_ACTION: 'myLoader', 92 | }, 93 | stopActions: { 94 | DUMMY_SUCCESS_ACTION: 'myLoader', 95 | DUMMY_FAILURE_ACTION: 'myLoader', 96 | }, 97 | }; 98 | 99 | expect(newState).toEqual(expectedState); 100 | }); 101 | 102 | it('should return new state with unregistered loader', () => { 103 | const registeredState = reducer(initialState, registerAction); 104 | const loadingState = reducer(registeredState, startLoadingAction); 105 | const stoppedState = reducer(loadingState, stopLoadingAction); 106 | const newState = reducer(stoppedState, unregisterAction); 107 | 108 | expect(newState).toEqual(initialState); 109 | }); 110 | -------------------------------------------------------------------------------- /examples/basic/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Basic Redux Loader Example 5 | 6 | 137 | 138 | 139 | 140 |
    141 | 142 |
    143 |
    Loading...
    144 |
    145 |
    146 | 147 | 148 |
    149 | 150 |
    151 |
    Loading...
    152 |
    153 |
    154 | 155 | 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /examples/basic/dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Basic Redux Loader Example 5 | 6 | 137 | 138 | 139 | 140 |
    141 | 142 |
    143 |
    Loading...
    144 |
    145 |
    146 | 147 | 148 |
    149 | 150 |
    151 |
    Loading...
    152 |
    153 |
    154 | 155 | 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | The document will walk you through the actions, reducer and middleware that comprises `redux-loader`. 3 | 4 | ## Actions 5 | 6 | Importing into a project. 7 | ```js 8 | import { reduxLoaderActions } from 'redux-loader'; 9 | ``` 10 | 11 | Redux Loader provides multiple actions as follows: 12 | ```js 13 | STOP_LOADING: '@@RL/STOP_LOADING' 14 | START_LOADING: '@@RL/START_LOADING' 15 | REGISTER_LOADER: '@@RL/REGISTER_LOADER' 16 | UNREGISTER_LOADER: '@@RL/UNREGISTER_LOADER' 17 | ``` 18 | 19 | **REGISTER_LOADER** 20 | 21 | Used to register a loader into the redux store. 22 | ```js 23 | { 24 | type: '@@RL/REGISTER_LOADER', 25 | payload: { 26 | id: 'loaderName', 27 | startActions: ['START_ACTION'], 28 | stopActions: ['SUCCESS_ACTION', 'FAILURE_ACTION'] 29 | } 30 | } 31 | ``` 32 | 33 | **UNREGISTER_LOADER** 34 | 35 | Used to unregister loader from redux store. 36 | 37 | ```js 38 | { 39 | type: '@@RL/UNREGISTER_LOADER', 40 | payload: 'loaderName' 41 | } 42 | ``` 43 | 44 | **START_LOADING** 45 | 46 | Used to enable loading state. 47 | 48 | ```js 49 | { 50 | type: '@@RL/START_LOADING', 51 | payload: 'loaderName' 52 | } 53 | ``` 54 | 55 | **STOP_LOADING** 56 | 57 | Used to disable loading state. 58 | 59 | ```js 60 | { 61 | type: '@@RL/STOP_LOADING', 62 | payload: 'loaderName' 63 | } 64 | ``` 65 | 66 | ## Action Creators 67 | 68 | **registerLoader** 69 | 70 | ```js 71 | registerLoader({ 72 | id: String, 73 | startActions: Array, 74 | stopActions: Array 75 | }) 76 | ``` 77 | 78 | Returns `@@RL/REGISTER_LOADER`. 79 | 80 | Example 81 | ```js 82 | reduxLoaderActions.registerLoader({ 83 | id: 'loaderName', 84 | startActions: ['START_ACTION'], 85 | stopActions: ['SUCCESS_ACTION', 'FAILURE_ACTION'] 86 | }); 87 | ``` 88 | 89 | **unregisterLoader** 90 | 91 | ```js 92 | unregisterLoader(id: String) 93 | ``` 94 | 95 | Returns `@@RL/UNREGISTER_LOADER`. 96 | 97 | Example 98 | ```js 99 | reduxLoaderActions.unregisterLoader('loaderName'); 100 | ``` 101 | 102 | **startLoading** 103 | 104 | ```js 105 | startLoading(id: String) 106 | ``` 107 | 108 | Returns `@@RL/START_LOADING`. 109 | 110 | Example 111 | ```js 112 | reduxLoaderActions.startLoading('loaderName'); 113 | ``` 114 | 115 | **stopLoading** 116 | 117 | ```js 118 | stopLoading(id: String) 119 | ``` 120 | 121 | Returns `@@RL/STOP_LOADING`. 122 | 123 | Example 124 | ```js 125 | reduxLoaderActions.stopLoading('loaderName'); 126 | ``` 127 | 128 | ## Reducer 129 | 130 | Importing the reducer 131 | ```js 132 | import { reduxLoaderReducer } from 'redux-loader'; 133 | ``` 134 | 135 | Using the reducer 136 | ```js 137 | const reducer = combineReducers({ 138 | reduxLoader: reduxLoaderReducer, 139 | // other reducers 140 | }); 141 | 142 | const store = createStore(reducer, ...); 143 | ``` 144 | 145 | This section describes the redux state registered by `redux-loader`. 146 | ![Redux Loader State](reducer.png "Redux Loader State") 147 | 148 | **history** 149 | 150 | Stores the dispatched `@REGISTER_LOADER` action payload as is, with the id as the key. 151 | 152 | **loaders** 153 | 154 | Stores the loader ids as key and `bool` as values. This is the main state used to enable or disable loading values. `@@RL/START_LOADING`, `@@RL/STOP_LOADING`, and `@@RL/UNREGISTER_LOADER` actions reference ids from this section. 155 | 156 | **startActions** 157 | 158 | Stores all the registered start action types. Each key represents the start action and value represents the loader that registered it. Values are replaced if a new loader registers the same start action. 159 | 160 | **stopActions** 161 | 162 | Stores all the registered stop action types. Each key represents the stop action and value represents the loader that registered it. Values are replaced if a new loader registers the same stop action. 163 | 164 | ## Middleware 165 | 166 | Importing the middleware 167 | 168 | ```js 169 | import { reduxLoaderMiddleware } from 'redux-loader'; 170 | ``` 171 | 172 | Using the middleware 173 | 174 | ```js 175 | //store.js 176 | 177 | import { reduxLoaderReducer, reduxLoaderMiddleware } from 'redux-loader'; 178 | import { applyMiddleware, createStore, compose, combineReducers } from 'redux'; 179 | 180 | const loaderMiddleware = reduxLoaderMiddleware(); 181 | const middlewares = [ 182 | loaderMiddleware, 183 | // other middlewares 184 | ] 185 | const enhancer = compose(applyMiddleware(...middlewares)); 186 | 187 | const reducer = combineReducers({ 188 | reduxLoader: reduxLoaderReducer, 189 | // other reducers 190 | }); 191 | 192 | const store = createStore(reducer, enhancer); 193 | ``` 194 | 195 | The `reduxLoaderMiddleware` function accepts a key that should be the same as the key used to add `reduxLoaderReducer` into `combineReducers`. 196 | 197 | ```js 198 | const loaderMiddleware = reduxLoaderMiddleware('myCustomLoader'); 199 | // Uses 'reduxLoader' by default 200 | 201 | const reducer = combineReducers({ 202 | myCustomLoader: reduxLoaderReducer, 203 | // other reducers 204 | }); 205 | ``` 206 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/nishanbajracharya/redux-state-loader.svg?branch=master)](https://travis-ci.org/nishanbajracharya/redux-state-loader) 2 | [![Package version](https://img.shields.io/badge/version-0.1.4-green.svg)](https://github.com/nishanbajracharya/redux-state-loader) 3 | 4 | 5 | # Redux State Loader 6 | A redux middleware to handle loading states triggered through start and stop actions. 7 | 8 | ## Why would I need this? 9 | Ever wanted a loading indicator while you are fetching a large amount of data. Ever wanted to block a submit button from being clicked again after you have submitted a form. Then this is the solution for you. Instead of going through the hassle of maintaining loading states for your buttons and containers, `redux-state-loader` does it for you. 10 | 11 | ## Getting started 12 | The first step is to add `redux-state-loader` into your project. 13 | 14 | ``` 15 | npm install --save redux-state-loader 16 | ``` 17 | 18 | > Note: The package itself has no dependencies but would be useless without [Redux](https://redux.js.org/). 19 | 20 | The next step is to register the middleware in the redux store. 21 | 22 | ```js 23 | //store.js 24 | 25 | import { reduxLoaderReducer, reduxLoaderMiddleware } from 'redux-state-loader'; 26 | import { applyMiddleware, createStore, compose, combineReducers } from 'redux'; 27 | 28 | const loaderMiddleware = reduxLoaderMiddleware(); 29 | const enhancer = compose(applyMiddleware(loaderMiddleware)); 30 | 31 | const reducer = combineReducers({ 32 | reduxLoader: reduxLoaderReducer, 33 | // other reducers 34 | }); 35 | 36 | const store = createStore(reducer, enhancer); 37 | ``` 38 | 39 | The `reduxLoaderMiddleware` function accepts a key that should be the same as the key used to add `reduxLoaderReducer` into `combineReducers`. 40 | 41 | ```js 42 | const loaderMiddleware = reduxLoaderMiddleware('myCustomLoader'); 43 | // Uses 'reduxLoader' by default 44 | 45 | const reducer = combineReducers({ 46 | myCustomLoader: reduxLoaderReducer, 47 | // other reducers 48 | }); 49 | ``` 50 | 51 | ## Usage 52 | Redux loader provides a bunch of actions that can be used to manage the loading states. 53 | 54 | ```js 55 | STOP_LOADING = '@@RL/STOP_LOADING' 56 | START_LOADING = '@@RL/START_LOADING' 57 | REGISTER_LOADER = '@@RL/REGISTER_LOADER' 58 | UNREGISTER_LOADER = '@@RL/UNREGISTER_LOADER' 59 | ``` 60 | > You'll only really need `REGISTER_LOADER` and `UNREGISTER_LOADER` but other actions can also be used. 61 | 62 | Also action creators. 63 | 64 | ```js 65 | registerLoader({ 66 | id: String, 67 | stopActions: Array, 68 | startActions: Array 69 | }): Action 70 | 71 | startLoading(id: String): Action 72 | 73 | stopLoading(id: String): Action 74 | 75 | unregisterLoader(id: String): Action 76 | ``` 77 | 78 | Start by importing the action creators. 79 | 80 | ```js 81 | import { reduxLoaderActions } from 'redux-state-loader'; 82 | ``` 83 | 84 | Next register a loader by supplying a unique id, start actions and stop actions. 85 | 86 | ```js 87 | const registerAction = reduxLoaderActions.registerLoader({ 88 | id: 'myLoader', 89 | startActions: ['TRIGGER_LOADING_ACTION'], 90 | stopActions: ['SUCCESS_ACTION', 'FAILURE_ACTION'], 91 | }); 92 | 93 | const unregisterAction = reduxLoaderActions.unregisterLoader('myLoader'); 94 | 95 | // Register a loader 96 | store.dispatch(registerAction); 97 | ``` 98 | Your redux state will look something like this. 99 | ![Redux Loader State](example-state.png "Redux Loader State") 100 | 101 | That's it. Now whenever a start action, eg. `TRIGGER_LOADING_ACTION` is dispatched, your registered loader, eg. `myLoader` will be set to `true`. Similarly, when either `SUCCESS_ACTION` or `FAILURE_ACTION` is dispatched, `myLoader` will be set to `false`. 102 | 103 | You can subscribe to the loader using redux's `subscribe` method or using [react-redux](https://github.com/reactjs/react-redux). 104 | 105 | ```js 106 | import { connect } from 'react-redux'; 107 | 108 | const Component = ({ myLoader: false }) => 109 |
    110 | {/* Other elements */} 111 | { 112 | myLoader && Loading... 113 | } 114 |
    ; 115 | 116 | const mapStateToProps = state => ({ 117 | myLoader: state.reduxLoader.loaders.myLoader, 118 | // Other props 119 | }); 120 | 121 | const EnhancedComponent = connect(mapStateToProps)(Component); 122 | ``` 123 | 124 | You can also manually trigger loading using `startLoading` and `stopLoading` actions. 125 | 126 | ```js 127 | import { reduxLoaderActions } from 'redux-state-loader'; 128 | 129 | // Trigger loading of myLoader 130 | store.dispatch(reduxLoaderActions.startLoading('myLoader')); 131 | 132 | // Stop loading of myLoader 133 | store.dispatch(reduxLoaderActions.stopLoading('myLoader')); 134 | ``` 135 | 136 | ## Documentation 137 | Read the docs using [this link](https://nishanbajracharya.github.io/redux-loader/). 138 | 139 | ## Contributing 140 | To contribute, follow one of the two options: 141 | 142 | - **Open an Issue** 143 | 144 | Open an issue detailing: 145 | 1. What the issue is 146 | 2. Steps to reproduce 147 | 3. Possible solutions 148 | 149 | Note: These details are recommended but are entirely optional. 150 | 151 | - **Send a Pull Request** 152 | 153 | Fork this project and send a pull request to the `master` branch. 154 | 155 | ## License 156 | MIT 157 | -------------------------------------------------------------------------------- /examples/basic/dist/basic.js: -------------------------------------------------------------------------------- 1 | // modules are defined as an array 2 | // [ module function, map of requires ] 3 | // 4 | // map of requires is short require name -> numeric require 5 | // 6 | // anything defined in a previous bundle is accessed via the 7 | // orig method which is the require for previous bundles 8 | 9 | // eslint-disable-next-line no-global-assign 10 | require = (function (modules, cache, entry) { 11 | // Save the require from previous bundle to this closure if any 12 | var previousRequire = typeof require === "function" && require; 13 | 14 | function newRequire(name, jumped) { 15 | if (!cache[name]) { 16 | if (!modules[name]) { 17 | // if we cannot find the module within our internal map or 18 | // cache jump to the current global require ie. the last bundle 19 | // that was added to the page. 20 | var currentRequire = typeof require === "function" && require; 21 | if (!jumped && currentRequire) { 22 | return currentRequire(name, true); 23 | } 24 | 25 | // If there are other bundles on this page the require from the 26 | // previous one is saved to 'previousRequire'. Repeat this as 27 | // many times as there are bundles until the module is found or 28 | // we exhaust the require chain. 29 | if (previousRequire) { 30 | return previousRequire(name, true); 31 | } 32 | 33 | var err = new Error('Cannot find module \'' + name + '\''); 34 | err.code = 'MODULE_NOT_FOUND'; 35 | throw err; 36 | } 37 | 38 | localRequire.resolve = resolve; 39 | 40 | var module = cache[name] = new newRequire.Module(name); 41 | 42 | modules[name][0].call(module.exports, localRequire, module, module.exports); 43 | } 44 | 45 | return cache[name].exports; 46 | 47 | function localRequire(x){ 48 | return newRequire(localRequire.resolve(x)); 49 | } 50 | 51 | function resolve(x){ 52 | return modules[name][1][x] || x; 53 | } 54 | } 55 | 56 | function Module(moduleName) { 57 | this.id = moduleName; 58 | this.bundle = newRequire; 59 | this.exports = {}; 60 | } 61 | 62 | newRequire.isParcelRequire = true; 63 | newRequire.Module = Module; 64 | newRequire.modules = modules; 65 | newRequire.cache = cache; 66 | newRequire.parent = previousRequire; 67 | 68 | for (var i = 0; i < entry.length; i++) { 69 | newRequire(entry[i]); 70 | } 71 | 72 | // Override the current require with this new one 73 | return newRequire; 74 | })({26:[function(require,module,exports) { 75 | var global = (1,eval)("this"); 76 | 'use strict'; 77 | 78 | Object.defineProperty(exports, "__esModule", { 79 | value: true 80 | }); 81 | /** Detect free variable `global` from Node.js. */ 82 | var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; 83 | 84 | exports.default = freeGlobal; 85 | },{}],25:[function(require,module,exports) { 86 | 'use strict'; 87 | 88 | Object.defineProperty(exports, "__esModule", { 89 | value: true 90 | }); 91 | 92 | var _freeGlobal = require('./_freeGlobal.js'); 93 | 94 | var _freeGlobal2 = _interopRequireDefault(_freeGlobal); 95 | 96 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 97 | 98 | /** Detect free variable `self`. */ 99 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 100 | 101 | /** Used as a reference to the global object. */ 102 | var root = _freeGlobal2.default || freeSelf || Function('return this')(); 103 | 104 | exports.default = root; 105 | },{"./_freeGlobal.js":26}],21:[function(require,module,exports) { 106 | 'use strict'; 107 | 108 | Object.defineProperty(exports, "__esModule", { 109 | value: true 110 | }); 111 | 112 | var _root = require('./_root.js'); 113 | 114 | var _root2 = _interopRequireDefault(_root); 115 | 116 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 117 | 118 | /** Built-in value references. */ 119 | var Symbol = _root2.default.Symbol; 120 | 121 | exports.default = Symbol; 122 | },{"./_root.js":25}],22:[function(require,module,exports) { 123 | 'use strict'; 124 | 125 | Object.defineProperty(exports, "__esModule", { 126 | value: true 127 | }); 128 | 129 | var _Symbol = require('./_Symbol.js'); 130 | 131 | var _Symbol2 = _interopRequireDefault(_Symbol); 132 | 133 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 134 | 135 | /** Used for built-in method references. */ 136 | var objectProto = Object.prototype; 137 | 138 | /** Used to check objects for own properties. */ 139 | var hasOwnProperty = objectProto.hasOwnProperty; 140 | 141 | /** 142 | * Used to resolve the 143 | * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 144 | * of values. 145 | */ 146 | var nativeObjectToString = objectProto.toString; 147 | 148 | /** Built-in value references. */ 149 | var symToStringTag = _Symbol2.default ? _Symbol2.default.toStringTag : undefined; 150 | 151 | /** 152 | * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. 153 | * 154 | * @private 155 | * @param {*} value The value to query. 156 | * @returns {string} Returns the raw `toStringTag`. 157 | */ 158 | function getRawTag(value) { 159 | var isOwn = hasOwnProperty.call(value, symToStringTag), 160 | tag = value[symToStringTag]; 161 | 162 | try { 163 | value[symToStringTag] = undefined; 164 | var unmasked = true; 165 | } catch (e) {} 166 | 167 | var result = nativeObjectToString.call(value); 168 | if (unmasked) { 169 | if (isOwn) { 170 | value[symToStringTag] = tag; 171 | } else { 172 | delete value[symToStringTag]; 173 | } 174 | } 175 | return result; 176 | } 177 | 178 | exports.default = getRawTag; 179 | },{"./_Symbol.js":21}],23:[function(require,module,exports) { 180 | "use strict"; 181 | 182 | Object.defineProperty(exports, "__esModule", { 183 | value: true 184 | }); 185 | /** Used for built-in method references. */ 186 | var objectProto = Object.prototype; 187 | 188 | /** 189 | * Used to resolve the 190 | * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 191 | * of values. 192 | */ 193 | var nativeObjectToString = objectProto.toString; 194 | 195 | /** 196 | * Converts `value` to a string using `Object.prototype.toString`. 197 | * 198 | * @private 199 | * @param {*} value The value to convert. 200 | * @returns {string} Returns the converted string. 201 | */ 202 | function objectToString(value) { 203 | return nativeObjectToString.call(value); 204 | } 205 | 206 | exports.default = objectToString; 207 | },{}],18:[function(require,module,exports) { 208 | 'use strict'; 209 | 210 | Object.defineProperty(exports, "__esModule", { 211 | value: true 212 | }); 213 | 214 | var _Symbol = require('./_Symbol.js'); 215 | 216 | var _Symbol2 = _interopRequireDefault(_Symbol); 217 | 218 | var _getRawTag = require('./_getRawTag.js'); 219 | 220 | var _getRawTag2 = _interopRequireDefault(_getRawTag); 221 | 222 | var _objectToString = require('./_objectToString.js'); 223 | 224 | var _objectToString2 = _interopRequireDefault(_objectToString); 225 | 226 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 227 | 228 | /** `Object#toString` result references. */ 229 | var nullTag = '[object Null]', 230 | undefinedTag = '[object Undefined]'; 231 | 232 | /** Built-in value references. */ 233 | var symToStringTag = _Symbol2.default ? _Symbol2.default.toStringTag : undefined; 234 | 235 | /** 236 | * The base implementation of `getTag` without fallbacks for buggy environments. 237 | * 238 | * @private 239 | * @param {*} value The value to query. 240 | * @returns {string} Returns the `toStringTag`. 241 | */ 242 | function baseGetTag(value) { 243 | if (value == null) { 244 | return value === undefined ? undefinedTag : nullTag; 245 | } 246 | return symToStringTag && symToStringTag in Object(value) ? (0, _getRawTag2.default)(value) : (0, _objectToString2.default)(value); 247 | } 248 | 249 | exports.default = baseGetTag; 250 | },{"./_Symbol.js":21,"./_getRawTag.js":22,"./_objectToString.js":23}],24:[function(require,module,exports) { 251 | "use strict"; 252 | 253 | Object.defineProperty(exports, "__esModule", { 254 | value: true 255 | }); 256 | /** 257 | * Creates a unary function that invokes `func` with its argument transformed. 258 | * 259 | * @private 260 | * @param {Function} func The function to wrap. 261 | * @param {Function} transform The argument transform. 262 | * @returns {Function} Returns the new function. 263 | */ 264 | function overArg(func, transform) { 265 | return function (arg) { 266 | return func(transform(arg)); 267 | }; 268 | } 269 | 270 | exports.default = overArg; 271 | },{}],19:[function(require,module,exports) { 272 | 'use strict'; 273 | 274 | Object.defineProperty(exports, "__esModule", { 275 | value: true 276 | }); 277 | 278 | var _overArg = require('./_overArg.js'); 279 | 280 | var _overArg2 = _interopRequireDefault(_overArg); 281 | 282 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 283 | 284 | /** Built-in value references. */ 285 | var getPrototype = (0, _overArg2.default)(Object.getPrototypeOf, Object); 286 | 287 | exports.default = getPrototype; 288 | },{"./_overArg.js":24}],20:[function(require,module,exports) { 289 | 'use strict'; 290 | 291 | Object.defineProperty(exports, "__esModule", { 292 | value: true 293 | }); 294 | /** 295 | * Checks if `value` is object-like. A value is object-like if it's not `null` 296 | * and has a `typeof` result of "object". 297 | * 298 | * @static 299 | * @memberOf _ 300 | * @since 4.0.0 301 | * @category Lang 302 | * @param {*} value The value to check. 303 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 304 | * @example 305 | * 306 | * _.isObjectLike({}); 307 | * // => true 308 | * 309 | * _.isObjectLike([1, 2, 3]); 310 | * // => true 311 | * 312 | * _.isObjectLike(_.noop); 313 | * // => false 314 | * 315 | * _.isObjectLike(null); 316 | * // => false 317 | */ 318 | function isObjectLike(value) { 319 | return value != null && typeof value == 'object'; 320 | } 321 | 322 | exports.default = isObjectLike; 323 | },{}],17:[function(require,module,exports) { 324 | 'use strict'; 325 | 326 | Object.defineProperty(exports, "__esModule", { 327 | value: true 328 | }); 329 | 330 | var _baseGetTag = require('./_baseGetTag.js'); 331 | 332 | var _baseGetTag2 = _interopRequireDefault(_baseGetTag); 333 | 334 | var _getPrototype = require('./_getPrototype.js'); 335 | 336 | var _getPrototype2 = _interopRequireDefault(_getPrototype); 337 | 338 | var _isObjectLike = require('./isObjectLike.js'); 339 | 340 | var _isObjectLike2 = _interopRequireDefault(_isObjectLike); 341 | 342 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 343 | 344 | /** `Object#toString` result references. */ 345 | var objectTag = '[object Object]'; 346 | 347 | /** Used for built-in method references. */ 348 | var funcProto = Function.prototype, 349 | objectProto = Object.prototype; 350 | 351 | /** Used to resolve the decompiled source of functions. */ 352 | var funcToString = funcProto.toString; 353 | 354 | /** Used to check objects for own properties. */ 355 | var hasOwnProperty = objectProto.hasOwnProperty; 356 | 357 | /** Used to infer the `Object` constructor. */ 358 | var objectCtorString = funcToString.call(Object); 359 | 360 | /** 361 | * Checks if `value` is a plain object, that is, an object created by the 362 | * `Object` constructor or one with a `[[Prototype]]` of `null`. 363 | * 364 | * @static 365 | * @memberOf _ 366 | * @since 0.8.0 367 | * @category Lang 368 | * @param {*} value The value to check. 369 | * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. 370 | * @example 371 | * 372 | * function Foo() { 373 | * this.a = 1; 374 | * } 375 | * 376 | * _.isPlainObject(new Foo); 377 | * // => false 378 | * 379 | * _.isPlainObject([1, 2, 3]); 380 | * // => false 381 | * 382 | * _.isPlainObject({ 'x': 0, 'y': 0 }); 383 | * // => true 384 | * 385 | * _.isPlainObject(Object.create(null)); 386 | * // => true 387 | */ 388 | function isPlainObject(value) { 389 | if (!(0, _isObjectLike2.default)(value) || (0, _baseGetTag2.default)(value) != objectTag) { 390 | return false; 391 | } 392 | var proto = (0, _getPrototype2.default)(value); 393 | if (proto === null) { 394 | return true; 395 | } 396 | var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; 397 | return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; 398 | } 399 | 400 | exports.default = isPlainObject; 401 | },{"./_baseGetTag.js":18,"./_getPrototype.js":19,"./isObjectLike.js":20}],16:[function(require,module,exports) { 402 | 'use strict'; 403 | 404 | Object.defineProperty(exports, "__esModule", { 405 | value: true 406 | }); 407 | exports.default = symbolObservablePonyfill; 408 | function symbolObservablePonyfill(root) { 409 | var result; 410 | var Symbol = root.Symbol; 411 | 412 | if (typeof Symbol === 'function') { 413 | if (Symbol.observable) { 414 | result = Symbol.observable; 415 | } else { 416 | result = Symbol('observable'); 417 | Symbol.observable = result; 418 | } 419 | } else { 420 | result = '@@observable'; 421 | } 422 | 423 | return result; 424 | }; 425 | },{}],15:[function(require,module,exports) { 426 | var global = (1,eval)("this"); 427 | 'use strict'; 428 | 429 | Object.defineProperty(exports, "__esModule", { 430 | value: true 431 | }); 432 | 433 | var _ponyfill = require('./ponyfill.js'); 434 | 435 | var _ponyfill2 = _interopRequireDefault(_ponyfill); 436 | 437 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 438 | 439 | var root; /* global window */ 440 | 441 | 442 | if (typeof self !== 'undefined') { 443 | root = self; 444 | } else if (typeof window !== 'undefined') { 445 | root = window; 446 | } else if (typeof global !== 'undefined') { 447 | root = global; 448 | } else if (typeof module !== 'undefined') { 449 | root = module; 450 | } else { 451 | root = Function('return this')(); 452 | } 453 | 454 | var result = (0, _ponyfill2.default)(root); 455 | exports.default = result; 456 | },{"./ponyfill.js":16}],9:[function(require,module,exports) { 457 | 'use strict'; 458 | 459 | Object.defineProperty(exports, "__esModule", { 460 | value: true 461 | }); 462 | exports.ActionTypes = undefined; 463 | exports.default = createStore; 464 | 465 | var _isPlainObject = require('lodash-es/isPlainObject'); 466 | 467 | var _isPlainObject2 = _interopRequireDefault(_isPlainObject); 468 | 469 | var _symbolObservable = require('symbol-observable'); 470 | 471 | var _symbolObservable2 = _interopRequireDefault(_symbolObservable); 472 | 473 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 474 | 475 | /** 476 | * These are private action types reserved by Redux. 477 | * For any unknown actions, you must return the current state. 478 | * If the current state is undefined, you must return the initial state. 479 | * Do not reference these action types directly in your code. 480 | */ 481 | var ActionTypes = exports.ActionTypes = { 482 | INIT: '@@redux/INIT' 483 | 484 | /** 485 | * Creates a Redux store that holds the state tree. 486 | * The only way to change the data in the store is to call `dispatch()` on it. 487 | * 488 | * There should only be a single store in your app. To specify how different 489 | * parts of the state tree respond to actions, you may combine several reducers 490 | * into a single reducer function by using `combineReducers`. 491 | * 492 | * @param {Function} reducer A function that returns the next state tree, given 493 | * the current state tree and the action to handle. 494 | * 495 | * @param {any} [preloadedState] The initial state. You may optionally specify it 496 | * to hydrate the state from the server in universal apps, or to restore a 497 | * previously serialized user session. 498 | * If you use `combineReducers` to produce the root reducer function, this must be 499 | * an object with the same shape as `combineReducers` keys. 500 | * 501 | * @param {Function} [enhancer] The store enhancer. You may optionally specify it 502 | * to enhance the store with third-party capabilities such as middleware, 503 | * time travel, persistence, etc. The only store enhancer that ships with Redux 504 | * is `applyMiddleware()`. 505 | * 506 | * @returns {Store} A Redux store that lets you read the state, dispatch actions 507 | * and subscribe to changes. 508 | */ 509 | };function createStore(reducer, preloadedState, enhancer) { 510 | var _ref2; 511 | 512 | if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') { 513 | enhancer = preloadedState; 514 | preloadedState = undefined; 515 | } 516 | 517 | if (typeof enhancer !== 'undefined') { 518 | if (typeof enhancer !== 'function') { 519 | throw new Error('Expected the enhancer to be a function.'); 520 | } 521 | 522 | return enhancer(createStore)(reducer, preloadedState); 523 | } 524 | 525 | if (typeof reducer !== 'function') { 526 | throw new Error('Expected the reducer to be a function.'); 527 | } 528 | 529 | var currentReducer = reducer; 530 | var currentState = preloadedState; 531 | var currentListeners = []; 532 | var nextListeners = currentListeners; 533 | var isDispatching = false; 534 | 535 | function ensureCanMutateNextListeners() { 536 | if (nextListeners === currentListeners) { 537 | nextListeners = currentListeners.slice(); 538 | } 539 | } 540 | 541 | /** 542 | * Reads the state tree managed by the store. 543 | * 544 | * @returns {any} The current state tree of your application. 545 | */ 546 | function getState() { 547 | return currentState; 548 | } 549 | 550 | /** 551 | * Adds a change listener. It will be called any time an action is dispatched, 552 | * and some part of the state tree may potentially have changed. You may then 553 | * call `getState()` to read the current state tree inside the callback. 554 | * 555 | * You may call `dispatch()` from a change listener, with the following 556 | * caveats: 557 | * 558 | * 1. The subscriptions are snapshotted just before every `dispatch()` call. 559 | * If you subscribe or unsubscribe while the listeners are being invoked, this 560 | * will not have any effect on the `dispatch()` that is currently in progress. 561 | * However, the next `dispatch()` call, whether nested or not, will use a more 562 | * recent snapshot of the subscription list. 563 | * 564 | * 2. The listener should not expect to see all state changes, as the state 565 | * might have been updated multiple times during a nested `dispatch()` before 566 | * the listener is called. It is, however, guaranteed that all subscribers 567 | * registered before the `dispatch()` started will be called with the latest 568 | * state by the time it exits. 569 | * 570 | * @param {Function} listener A callback to be invoked on every dispatch. 571 | * @returns {Function} A function to remove this change listener. 572 | */ 573 | function subscribe(listener) { 574 | if (typeof listener !== 'function') { 575 | throw new Error('Expected listener to be a function.'); 576 | } 577 | 578 | var isSubscribed = true; 579 | 580 | ensureCanMutateNextListeners(); 581 | nextListeners.push(listener); 582 | 583 | return function unsubscribe() { 584 | if (!isSubscribed) { 585 | return; 586 | } 587 | 588 | isSubscribed = false; 589 | 590 | ensureCanMutateNextListeners(); 591 | var index = nextListeners.indexOf(listener); 592 | nextListeners.splice(index, 1); 593 | }; 594 | } 595 | 596 | /** 597 | * Dispatches an action. It is the only way to trigger a state change. 598 | * 599 | * The `reducer` function, used to create the store, will be called with the 600 | * current state tree and the given `action`. Its return value will 601 | * be considered the **next** state of the tree, and the change listeners 602 | * will be notified. 603 | * 604 | * The base implementation only supports plain object actions. If you want to 605 | * dispatch a Promise, an Observable, a thunk, or something else, you need to 606 | * wrap your store creating function into the corresponding middleware. For 607 | * example, see the documentation for the `redux-thunk` package. Even the 608 | * middleware will eventually dispatch plain object actions using this method. 609 | * 610 | * @param {Object} action A plain object representing “what changed”. It is 611 | * a good idea to keep actions serializable so you can record and replay user 612 | * sessions, or use the time travelling `redux-devtools`. An action must have 613 | * a `type` property which may not be `undefined`. It is a good idea to use 614 | * string constants for action types. 615 | * 616 | * @returns {Object} For convenience, the same action object you dispatched. 617 | * 618 | * Note that, if you use a custom middleware, it may wrap `dispatch()` to 619 | * return something else (for example, a Promise you can await). 620 | */ 621 | function dispatch(action) { 622 | if (!(0, _isPlainObject2.default)(action)) { 623 | throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.'); 624 | } 625 | 626 | if (typeof action.type === 'undefined') { 627 | throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?'); 628 | } 629 | 630 | if (isDispatching) { 631 | throw new Error('Reducers may not dispatch actions.'); 632 | } 633 | 634 | try { 635 | isDispatching = true; 636 | currentState = currentReducer(currentState, action); 637 | } finally { 638 | isDispatching = false; 639 | } 640 | 641 | var listeners = currentListeners = nextListeners; 642 | for (var i = 0; i < listeners.length; i++) { 643 | var listener = listeners[i]; 644 | listener(); 645 | } 646 | 647 | return action; 648 | } 649 | 650 | /** 651 | * Replaces the reducer currently used by the store to calculate the state. 652 | * 653 | * You might need this if your app implements code splitting and you want to 654 | * load some of the reducers dynamically. You might also need this if you 655 | * implement a hot reloading mechanism for Redux. 656 | * 657 | * @param {Function} nextReducer The reducer for the store to use instead. 658 | * @returns {void} 659 | */ 660 | function replaceReducer(nextReducer) { 661 | if (typeof nextReducer !== 'function') { 662 | throw new Error('Expected the nextReducer to be a function.'); 663 | } 664 | 665 | currentReducer = nextReducer; 666 | dispatch({ type: ActionTypes.INIT }); 667 | } 668 | 669 | /** 670 | * Interoperability point for observable/reactive libraries. 671 | * @returns {observable} A minimal observable of state changes. 672 | * For more information, see the observable proposal: 673 | * https://github.com/tc39/proposal-observable 674 | */ 675 | function observable() { 676 | var _ref; 677 | 678 | var outerSubscribe = subscribe; 679 | return _ref = { 680 | /** 681 | * The minimal observable subscription method. 682 | * @param {Object} observer Any object that can be used as an observer. 683 | * The observer object should have a `next` method. 684 | * @returns {subscription} An object with an `unsubscribe` method that can 685 | * be used to unsubscribe the observable from the store, and prevent further 686 | * emission of values from the observable. 687 | */ 688 | subscribe: function subscribe(observer) { 689 | if (typeof observer !== 'object') { 690 | throw new TypeError('Expected the observer to be an object.'); 691 | } 692 | 693 | function observeState() { 694 | if (observer.next) { 695 | observer.next(getState()); 696 | } 697 | } 698 | 699 | observeState(); 700 | var unsubscribe = outerSubscribe(observeState); 701 | return { unsubscribe: unsubscribe }; 702 | } 703 | }, _ref[_symbolObservable2.default] = function () { 704 | return this; 705 | }, _ref; 706 | } 707 | 708 | // When a store is created, an "INIT" action is dispatched so that every 709 | // reducer returns their initial state. This effectively populates 710 | // the initial state tree. 711 | dispatch({ type: ActionTypes.INIT }); 712 | 713 | return _ref2 = { 714 | dispatch: dispatch, 715 | subscribe: subscribe, 716 | getState: getState, 717 | replaceReducer: replaceReducer 718 | }, _ref2[_symbolObservable2.default] = observable, _ref2; 719 | } 720 | },{"lodash-es/isPlainObject":17,"symbol-observable":15}],14:[function(require,module,exports) { 721 | 'use strict'; 722 | 723 | Object.defineProperty(exports, "__esModule", { 724 | value: true 725 | }); 726 | exports.default = warning; 727 | /** 728 | * Prints a warning in the console if it exists. 729 | * 730 | * @param {String} message The warning message. 731 | * @returns {void} 732 | */ 733 | function warning(message) { 734 | /* eslint-disable no-console */ 735 | if (typeof console !== 'undefined' && typeof console.error === 'function') { 736 | console.error(message); 737 | } 738 | /* eslint-enable no-console */ 739 | try { 740 | // This error was thrown as a convenience so that if you enable 741 | // "break on all exceptions" in your console, 742 | // it would pause the execution at this line. 743 | throw new Error(message); 744 | /* eslint-disable no-empty */ 745 | } catch (e) {} 746 | /* eslint-enable no-empty */ 747 | } 748 | },{}],11:[function(require,module,exports) { 749 | 'use strict'; 750 | 751 | Object.defineProperty(exports, "__esModule", { 752 | value: true 753 | }); 754 | exports.default = combineReducers; 755 | 756 | var _createStore = require('./createStore'); 757 | 758 | var _isPlainObject = require('lodash-es/isPlainObject'); 759 | 760 | var _isPlainObject2 = _interopRequireDefault(_isPlainObject); 761 | 762 | var _warning = require('./utils/warning'); 763 | 764 | var _warning2 = _interopRequireDefault(_warning); 765 | 766 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 767 | 768 | function getUndefinedStateErrorMessage(key, action) { 769 | var actionType = action && action.type; 770 | var actionName = actionType && '"' + actionType.toString() + '"' || 'an action'; 771 | 772 | return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state. ' + 'If you want this reducer to hold no value, you can return null instead of undefined.'; 773 | } 774 | 775 | function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) { 776 | var reducerKeys = Object.keys(reducers); 777 | var argumentName = action && action.type === _createStore.ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer'; 778 | 779 | if (reducerKeys.length === 0) { 780 | return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.'; 781 | } 782 | 783 | if (!(0, _isPlainObject2.default)(inputState)) { 784 | return 'The ' + argumentName + ' has unexpected type of "' + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"'); 785 | } 786 | 787 | var unexpectedKeys = Object.keys(inputState).filter(function (key) { 788 | return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]; 789 | }); 790 | 791 | unexpectedKeys.forEach(function (key) { 792 | unexpectedKeyCache[key] = true; 793 | }); 794 | 795 | if (unexpectedKeys.length > 0) { 796 | return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.'); 797 | } 798 | } 799 | 800 | function assertReducerShape(reducers) { 801 | Object.keys(reducers).forEach(function (key) { 802 | var reducer = reducers[key]; 803 | var initialState = reducer(undefined, { type: _createStore.ActionTypes.INIT }); 804 | 805 | if (typeof initialState === 'undefined') { 806 | throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined. If you don\'t want to set a value for this reducer, ' + 'you can use null instead of undefined.'); 807 | } 808 | 809 | var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.'); 810 | if (typeof reducer(undefined, { type: type }) === 'undefined') { 811 | throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + _createStore.ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined, but can be null.'); 812 | } 813 | }); 814 | } 815 | 816 | /** 817 | * Turns an object whose values are different reducer functions, into a single 818 | * reducer function. It will call every child reducer, and gather their results 819 | * into a single state object, whose keys correspond to the keys of the passed 820 | * reducer functions. 821 | * 822 | * @param {Object} reducers An object whose values correspond to different 823 | * reducer functions that need to be combined into one. One handy way to obtain 824 | * it is to use ES6 `import * as reducers` syntax. The reducers may never return 825 | * undefined for any action. Instead, they should return their initial state 826 | * if the state passed to them was undefined, and the current state for any 827 | * unrecognized action. 828 | * 829 | * @returns {Function} A reducer function that invokes every reducer inside the 830 | * passed object, and builds a state object with the same shape. 831 | */ 832 | function combineReducers(reducers) { 833 | var reducerKeys = Object.keys(reducers); 834 | var finalReducers = {}; 835 | for (var i = 0; i < reducerKeys.length; i++) { 836 | var key = reducerKeys[i]; 837 | 838 | if ('development' !== 'production') { 839 | if (typeof reducers[key] === 'undefined') { 840 | (0, _warning2.default)('No reducer provided for key "' + key + '"'); 841 | } 842 | } 843 | 844 | if (typeof reducers[key] === 'function') { 845 | finalReducers[key] = reducers[key]; 846 | } 847 | } 848 | var finalReducerKeys = Object.keys(finalReducers); 849 | 850 | var unexpectedKeyCache = void 0; 851 | if ('development' !== 'production') { 852 | unexpectedKeyCache = {}; 853 | } 854 | 855 | var shapeAssertionError = void 0; 856 | try { 857 | assertReducerShape(finalReducers); 858 | } catch (e) { 859 | shapeAssertionError = e; 860 | } 861 | 862 | return function combination() { 863 | var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 864 | var action = arguments[1]; 865 | 866 | if (shapeAssertionError) { 867 | throw shapeAssertionError; 868 | } 869 | 870 | if ('development' !== 'production') { 871 | var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache); 872 | if (warningMessage) { 873 | (0, _warning2.default)(warningMessage); 874 | } 875 | } 876 | 877 | var hasChanged = false; 878 | var nextState = {}; 879 | for (var _i = 0; _i < finalReducerKeys.length; _i++) { 880 | var _key = finalReducerKeys[_i]; 881 | var reducer = finalReducers[_key]; 882 | var previousStateForKey = state[_key]; 883 | var nextStateForKey = reducer(previousStateForKey, action); 884 | if (typeof nextStateForKey === 'undefined') { 885 | var errorMessage = getUndefinedStateErrorMessage(_key, action); 886 | throw new Error(errorMessage); 887 | } 888 | nextState[_key] = nextStateForKey; 889 | hasChanged = hasChanged || nextStateForKey !== previousStateForKey; 890 | } 891 | return hasChanged ? nextState : state; 892 | }; 893 | } 894 | },{"./createStore":9,"lodash-es/isPlainObject":17,"./utils/warning":14}],10:[function(require,module,exports) { 895 | 'use strict'; 896 | 897 | Object.defineProperty(exports, "__esModule", { 898 | value: true 899 | }); 900 | exports.default = bindActionCreators; 901 | function bindActionCreator(actionCreator, dispatch) { 902 | return function () { 903 | return dispatch(actionCreator.apply(undefined, arguments)); 904 | }; 905 | } 906 | 907 | /** 908 | * Turns an object whose values are action creators, into an object with the 909 | * same keys, but with every function wrapped into a `dispatch` call so they 910 | * may be invoked directly. This is just a convenience method, as you can call 911 | * `store.dispatch(MyActionCreators.doSomething())` yourself just fine. 912 | * 913 | * For convenience, you can also pass a single function as the first argument, 914 | * and get a function in return. 915 | * 916 | * @param {Function|Object} actionCreators An object whose values are action 917 | * creator functions. One handy way to obtain it is to use ES6 `import * as` 918 | * syntax. You may also pass a single function. 919 | * 920 | * @param {Function} dispatch The `dispatch` function available on your Redux 921 | * store. 922 | * 923 | * @returns {Function|Object} The object mimicking the original object, but with 924 | * every action creator wrapped into the `dispatch` call. If you passed a 925 | * function as `actionCreators`, the return value will also be a single 926 | * function. 927 | */ 928 | function bindActionCreators(actionCreators, dispatch) { 929 | if (typeof actionCreators === 'function') { 930 | return bindActionCreator(actionCreators, dispatch); 931 | } 932 | 933 | if (typeof actionCreators !== 'object' || actionCreators === null) { 934 | throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?'); 935 | } 936 | 937 | var keys = Object.keys(actionCreators); 938 | var boundActionCreators = {}; 939 | for (var i = 0; i < keys.length; i++) { 940 | var key = keys[i]; 941 | var actionCreator = actionCreators[key]; 942 | if (typeof actionCreator === 'function') { 943 | boundActionCreators[key] = bindActionCreator(actionCreator, dispatch); 944 | } 945 | } 946 | return boundActionCreators; 947 | } 948 | },{}],13:[function(require,module,exports) { 949 | "use strict"; 950 | 951 | Object.defineProperty(exports, "__esModule", { 952 | value: true 953 | }); 954 | exports.default = compose; 955 | /** 956 | * Composes single-argument functions from right to left. The rightmost 957 | * function can take multiple arguments as it provides the signature for 958 | * the resulting composite function. 959 | * 960 | * @param {...Function} funcs The functions to compose. 961 | * @returns {Function} A function obtained by composing the argument functions 962 | * from right to left. For example, compose(f, g, h) is identical to doing 963 | * (...args) => f(g(h(...args))). 964 | */ 965 | 966 | function compose() { 967 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) { 968 | funcs[_key] = arguments[_key]; 969 | } 970 | 971 | if (funcs.length === 0) { 972 | return function (arg) { 973 | return arg; 974 | }; 975 | } 976 | 977 | if (funcs.length === 1) { 978 | return funcs[0]; 979 | } 980 | 981 | return funcs.reduce(function (a, b) { 982 | return function () { 983 | return a(b.apply(undefined, arguments)); 984 | }; 985 | }); 986 | } 987 | },{}],12:[function(require,module,exports) { 988 | 'use strict'; 989 | 990 | Object.defineProperty(exports, "__esModule", { 991 | value: true 992 | }); 993 | exports.default = applyMiddleware; 994 | 995 | var _compose = require('./compose'); 996 | 997 | var _compose2 = _interopRequireDefault(_compose); 998 | 999 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1000 | 1001 | var _extends = Object.assign || function (target) { 1002 | for (var i = 1; i < arguments.length; i++) { 1003 | var source = arguments[i];for (var key in source) { 1004 | if (Object.prototype.hasOwnProperty.call(source, key)) { 1005 | target[key] = source[key]; 1006 | } 1007 | } 1008 | }return target; 1009 | }; 1010 | 1011 | /** 1012 | * Creates a store enhancer that applies middleware to the dispatch method 1013 | * of the Redux store. This is handy for a variety of tasks, such as expressing 1014 | * asynchronous actions in a concise manner, or logging every action payload. 1015 | * 1016 | * See `redux-thunk` package as an example of the Redux middleware. 1017 | * 1018 | * Because middleware is potentially asynchronous, this should be the first 1019 | * store enhancer in the composition chain. 1020 | * 1021 | * Note that each middleware will be given the `dispatch` and `getState` functions 1022 | * as named arguments. 1023 | * 1024 | * @param {...Function} middlewares The middleware chain to be applied. 1025 | * @returns {Function} A store enhancer applying the middleware. 1026 | */ 1027 | function applyMiddleware() { 1028 | for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) { 1029 | middlewares[_key] = arguments[_key]; 1030 | } 1031 | 1032 | return function (createStore) { 1033 | return function (reducer, preloadedState, enhancer) { 1034 | var store = createStore(reducer, preloadedState, enhancer); 1035 | var _dispatch = store.dispatch; 1036 | var chain = []; 1037 | 1038 | var middlewareAPI = { 1039 | getState: store.getState, 1040 | dispatch: function dispatch(action) { 1041 | return _dispatch(action); 1042 | } 1043 | }; 1044 | chain = middlewares.map(function (middleware) { 1045 | return middleware(middlewareAPI); 1046 | }); 1047 | _dispatch = _compose2.default.apply(undefined, chain)(store.dispatch); 1048 | 1049 | return _extends({}, store, { 1050 | dispatch: _dispatch 1051 | }); 1052 | }; 1053 | }; 1054 | } 1055 | },{"./compose":13}],5:[function(require,module,exports) { 1056 | 'use strict'; 1057 | 1058 | Object.defineProperty(exports, "__esModule", { 1059 | value: true 1060 | }); 1061 | exports.compose = exports.applyMiddleware = exports.bindActionCreators = exports.combineReducers = exports.createStore = undefined; 1062 | 1063 | var _createStore = require('./createStore'); 1064 | 1065 | var _createStore2 = _interopRequireDefault(_createStore); 1066 | 1067 | var _combineReducers = require('./combineReducers'); 1068 | 1069 | var _combineReducers2 = _interopRequireDefault(_combineReducers); 1070 | 1071 | var _bindActionCreators = require('./bindActionCreators'); 1072 | 1073 | var _bindActionCreators2 = _interopRequireDefault(_bindActionCreators); 1074 | 1075 | var _applyMiddleware = require('./applyMiddleware'); 1076 | 1077 | var _applyMiddleware2 = _interopRequireDefault(_applyMiddleware); 1078 | 1079 | var _compose = require('./compose'); 1080 | 1081 | var _compose2 = _interopRequireDefault(_compose); 1082 | 1083 | var _warning = require('./utils/warning'); 1084 | 1085 | var _warning2 = _interopRequireDefault(_warning); 1086 | 1087 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1088 | 1089 | /* 1090 | * This is a dummy function to check if the function name has been altered by minification. 1091 | * If the function has been minified and NODE_ENV !== 'production', warn the user. 1092 | */ 1093 | function isCrushed() {} 1094 | 1095 | if ('development' !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') { 1096 | (0, _warning2.default)('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.'); 1097 | } 1098 | 1099 | exports.createStore = _createStore2.default; 1100 | exports.combineReducers = _combineReducers2.default; 1101 | exports.bindActionCreators = _bindActionCreators2.default; 1102 | exports.applyMiddleware = _applyMiddleware2.default; 1103 | exports.compose = _compose2.default; 1104 | },{"./createStore":9,"./combineReducers":11,"./bindActionCreators":10,"./applyMiddleware":12,"./compose":13,"./utils/warning":14}],7:[function(require,module,exports) { 1105 | 'use strict'; 1106 | 1107 | Object.defineProperty(exports, "__esModule", { 1108 | value: true 1109 | }); 1110 | var STOP_LOADING = exports.STOP_LOADING = '@@RL/STOP_LOADING'; 1111 | var START_LOADING = exports.START_LOADING = '@@RL/START_LOADING'; 1112 | var REGISTER_LOADER = exports.REGISTER_LOADER = '@@RL/REGISTER_LOADER'; 1113 | var UNREGISTER_LOADER = exports.UNREGISTER_LOADER = '@@RL/UNREGISTER_LOADER'; 1114 | 1115 | var stopLoading = exports.stopLoading = function stopLoading(id) { 1116 | return { 1117 | type: STOP_LOADING, 1118 | payload: id 1119 | }; 1120 | }; 1121 | 1122 | var startLoading = exports.startLoading = function startLoading(id) { 1123 | return { 1124 | type: START_LOADING, 1125 | payload: id 1126 | }; 1127 | }; 1128 | 1129 | var registerLoader = exports.registerLoader = function registerLoader(_ref) { 1130 | var id = _ref.id, 1131 | stopActions = _ref.stopActions, 1132 | startActions = _ref.startActions; 1133 | return { 1134 | type: REGISTER_LOADER, 1135 | payload: { 1136 | id: id, 1137 | stopActions: stopActions, 1138 | startActions: startActions 1139 | } 1140 | }; 1141 | }; 1142 | 1143 | var unregisterLoader = exports.unregisterLoader = function unregisterLoader(id) { 1144 | return { 1145 | type: UNREGISTER_LOADER, 1146 | payload: id 1147 | }; 1148 | }; 1149 | 1150 | exports.default = { 1151 | // Actions 1152 | STOP_LOADING: STOP_LOADING, 1153 | START_LOADING: START_LOADING, 1154 | REGISTER_LOADER: REGISTER_LOADER, 1155 | UNREGISTER_LOADER: UNREGISTER_LOADER, 1156 | 1157 | // Action creators 1158 | stopLoading: stopLoading, 1159 | startLoading: startLoading, 1160 | registerLoader: registerLoader, 1161 | unregisterLoader: unregisterLoader 1162 | }; 1163 | },{}],6:[function(require,module,exports) { 1164 | 'use strict'; 1165 | 1166 | Object.defineProperty(exports, "__esModule", { 1167 | value: true 1168 | }); 1169 | 1170 | var _extends = Object.assign || function (target) { 1171 | for (var i = 1; i < arguments.length; i++) { 1172 | var source = arguments[i];for (var key in source) { 1173 | if (Object.prototype.hasOwnProperty.call(source, key)) { 1174 | target[key] = source[key]; 1175 | } 1176 | } 1177 | }return target; 1178 | }; 1179 | 1180 | var _actions = require('./actions'); 1181 | 1182 | var _actions2 = _interopRequireDefault(_actions); 1183 | 1184 | function _interopRequireDefault(obj) { 1185 | return obj && obj.__esModule ? obj : { default: obj }; 1186 | } 1187 | 1188 | function _defineProperty(obj, key, value) { 1189 | if (key in obj) { 1190 | Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); 1191 | } else { 1192 | obj[key] = value; 1193 | }return obj; 1194 | } 1195 | 1196 | var omit = function omit() { 1197 | var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1198 | var blacklist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; 1199 | return Object.keys(obj).filter(function (key) { 1200 | return !blacklist.includes(key); 1201 | }).reduce(function (newObj, key) { 1202 | return _extends({}, newObj, _defineProperty({}, key, obj[key])); 1203 | }, {}); 1204 | }; 1205 | 1206 | var reduceArrayToObjectValue = function reduceArrayToObjectValue() { 1207 | var ids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 1208 | var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 1209 | return ids.reduce(function (acc, id) { 1210 | return _extends({}, acc, _defineProperty({}, id, status)); 1211 | }, {}); 1212 | }; 1213 | 1214 | var INITIAL_STATE = { 1215 | history: {}, 1216 | loaders: {}, 1217 | startActions: {}, 1218 | stopActions: {} 1219 | }; 1220 | 1221 | var reducer = function reducer() { 1222 | var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_STATE; 1223 | var action = arguments[1]; 1224 | 1225 | switch (action.type) { 1226 | case _actions2.default.REGISTER_LOADER: 1227 | return _extends({}, state, { 1228 | loaders: _extends({}, state.loaders, _defineProperty({}, action.payload.id, false)), 1229 | startActions: _extends({}, state.startActions, reduceArrayToObjectValue(action.payload.startActions, action.payload.id)), 1230 | stopActions: _extends({}, state.stopActions, reduceArrayToObjectValue(action.payload.stopActions, action.payload.id)), 1231 | history: _extends({}, state.history, _defineProperty({}, action.payload.id, action.payload)) 1232 | }); 1233 | case _actions2.default.UNREGISTER_LOADER: 1234 | return _extends({}, state, { 1235 | history: omit(state.history, action.payload), 1236 | loaders: omit(state.loaders, action.payload), 1237 | startActions: omit(state.startActions, state.history[action.payload].startActions), 1238 | stopActions: omit(state.stopActions, state.history[action.payload].stopActions) 1239 | }); 1240 | case _actions2.default.START_LOADING: 1241 | return _extends({}, state, { 1242 | loaders: _extends({}, state.loaders, _defineProperty({}, action.payload, true)) 1243 | }); 1244 | case _actions2.default.STOP_LOADING: 1245 | return _extends({}, state, { 1246 | loaders: _extends({}, state.loaders, _defineProperty({}, action.payload, false)) 1247 | }); 1248 | default: 1249 | return state; 1250 | } 1251 | }; 1252 | 1253 | exports.default = reducer; 1254 | },{"./actions":7}],8:[function(require,module,exports) { 1255 | 'use strict'; 1256 | 1257 | Object.defineProperty(exports, "__esModule", { 1258 | value: true 1259 | }); 1260 | 1261 | var _actions = require('./actions'); 1262 | 1263 | var _actions2 = _interopRequireDefault(_actions); 1264 | 1265 | function _interopRequireDefault(obj) { 1266 | return obj && obj.__esModule ? obj : { default: obj }; 1267 | } 1268 | 1269 | var DEFAULT_REDUCER = 'reduxLoader'; 1270 | 1271 | var middleware = function middleware() { 1272 | var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_REDUCER; 1273 | return function (store) { 1274 | return function (next) { 1275 | return function (action) { 1276 | var state = store.getState()[key]; 1277 | 1278 | if (state) { 1279 | next(action); 1280 | 1281 | var startActions = state.startActions || {}; 1282 | var startActionTypes = Object.keys(startActions); 1283 | 1284 | var stopActions = state.stopActions || {}; 1285 | var stopActionTypes = Object.keys(stopActions); 1286 | 1287 | if (startActionTypes.includes(action.type)) { 1288 | var id = startActions[action.type]; 1289 | 1290 | return next({ 1291 | type: _actions2.default.START_LOADING, 1292 | payload: id 1293 | }); 1294 | } 1295 | 1296 | if (stopActionTypes.includes(action.type)) { 1297 | var _id = stopActions[action.type]; 1298 | 1299 | return next({ 1300 | type: _actions2.default.STOP_LOADING, 1301 | payload: _id 1302 | }); 1303 | } 1304 | 1305 | return; 1306 | } 1307 | 1308 | return next(action); 1309 | }; 1310 | }; 1311 | }; 1312 | }; 1313 | 1314 | exports.default = middleware; 1315 | },{"./actions":7}],4:[function(require,module,exports) { 1316 | 'use strict'; 1317 | 1318 | Object.defineProperty(exports, "__esModule", { 1319 | value: true 1320 | }); 1321 | exports.reduxLoaderMiddleware = exports.reduxLoaderReducer = exports.reduxLoaderActions = undefined; 1322 | 1323 | var _reducer = require('./reducer'); 1324 | 1325 | var _reducer2 = _interopRequireDefault(_reducer); 1326 | 1327 | var _actions = require('./actions'); 1328 | 1329 | var _actions2 = _interopRequireDefault(_actions); 1330 | 1331 | var _middleware = require('./middleware'); 1332 | 1333 | var _middleware2 = _interopRequireDefault(_middleware); 1334 | 1335 | function _interopRequireDefault(obj) { 1336 | return obj && obj.__esModule ? obj : { default: obj }; 1337 | } 1338 | 1339 | exports.reduxLoaderActions = _actions2.default; 1340 | exports.reduxLoaderReducer = _reducer2.default; 1341 | exports.reduxLoaderMiddleware = _middleware2.default; 1342 | exports.default = { actions: _actions2.default, reducer: _reducer2.default, middleware: _middleware2.default }; 1343 | },{"./reducer":6,"./actions":7,"./middleware":8}],3:[function(require,module,exports) { 1344 | 'use strict'; 1345 | 1346 | Object.defineProperty(exports, "__esModule", { 1347 | value: true 1348 | }); 1349 | 1350 | var _redux = require('redux'); 1351 | 1352 | var _lib = require('../../lib'); 1353 | 1354 | var composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || _redux.compose; 1355 | var enhancer = composeEnhancers((0, _redux.applyMiddleware)((0, _lib.reduxLoaderMiddleware)())); 1356 | 1357 | var reducer = (0, _redux.combineReducers)({ 1358 | reduxLoader: _lib.reduxLoaderReducer 1359 | }); 1360 | 1361 | var store = (0, _redux.createStore)(reducer, enhancer); 1362 | 1363 | exports.default = store; 1364 | },{"redux":5,"../../lib":4}],2:[function(require,module,exports) { 1365 | 'use strict'; 1366 | 1367 | var _store = require('./store'); 1368 | 1369 | var _store2 = _interopRequireDefault(_store); 1370 | 1371 | var _lib = require('../../lib'); 1372 | 1373 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1374 | 1375 | var btn = document.querySelector('.button'); 1376 | var logElem = document.querySelector('.logs'); 1377 | var loading = document.querySelector('.loading'); 1378 | 1379 | var btn2 = document.querySelector('.button2'); 1380 | var loading2 = document.querySelector('.loading2'); 1381 | 1382 | var log = function log(action) { 1383 | var className = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 1384 | 1385 | logElem.innerHTML += '
  • ' + action.type + '
  • '; 1386 | }; 1387 | 1388 | _store2.default.subscribe(function () { 1389 | if (_store2.default.getState().reduxLoader.loaders.myLoader) { 1390 | loading.classList.add('show'); 1391 | } else { 1392 | loading.classList.remove('show'); 1393 | } 1394 | 1395 | if (_store2.default.getState().reduxLoader.loaders.myLoader2) { 1396 | loading2.classList.add('show'); 1397 | } else { 1398 | loading2.classList.remove('show'); 1399 | } 1400 | }); 1401 | 1402 | var registerAction = { 1403 | type: _lib.reduxLoaderActions.REGISTER_LOADER, 1404 | payload: { 1405 | id: 'myLoader', 1406 | startActions: ['SOME_ACTION_THAT_TRIGGERS_LOADING', 'ANOTHER_ACTION'], 1407 | stopActions: ['SUCCESS', 'FAILURE'] 1408 | } 1409 | }; 1410 | 1411 | var successAction = { 1412 | type: 'SUCCESS' 1413 | }; 1414 | 1415 | var failureAction = { 1416 | type: 'FAILURE' 1417 | }; 1418 | 1419 | var triggerAction = { type: 'SOME_ACTION_THAT_TRIGGERS_LOADING' }; 1420 | 1421 | _store2.default.dispatch(registerAction); 1422 | 1423 | _store2.default.dispatch({ 1424 | type: _lib.reduxLoaderActions.REGISTER_LOADER, 1425 | payload: { 1426 | id: 'myLoader2', 1427 | startActions: ['SOME_ACTION_THAT_TRIGGERS_LOADING_2', 'ANOTHER_ACTION_2'], 1428 | stopActions: ['SUCCESS_2', 'FAILURE_2'] 1429 | } 1430 | }); 1431 | 1432 | var triggerExample = function triggerExample(triggerAction, successAction, failureAction) { 1433 | _store2.default.dispatch(triggerAction); 1434 | log(triggerAction); 1435 | 1436 | var success = Math.round(Math.random()); 1437 | 1438 | setTimeout(function () { 1439 | if (success) { 1440 | _store2.default.dispatch(successAction); 1441 | log(successAction, 'success'); 1442 | } else { 1443 | _store2.default.dispatch(failureAction); 1444 | log(failureAction, 'failure'); 1445 | } 1446 | }, 1500); 1447 | }; 1448 | 1449 | btn.onclick = function () { 1450 | return triggerExample(triggerAction, successAction, failureAction); 1451 | }; 1452 | 1453 | btn2.onclick = function () { 1454 | return triggerExample({ 1455 | type: 'ANOTHER_ACTION_2' 1456 | }, { 1457 | type: 'SUCCESS_2' 1458 | }, { 1459 | type: 'FAILURE_2' 1460 | }); 1461 | }; 1462 | },{"./store":3,"../../lib":4}],27:[function(require,module,exports) { 1463 | 1464 | var global = (1, eval)('this'); 1465 | var OldModule = module.bundle.Module; 1466 | function Module(moduleName) { 1467 | OldModule.call(this, moduleName); 1468 | this.hot = { 1469 | accept: function (fn) { 1470 | this._acceptCallback = fn || function () {}; 1471 | }, 1472 | dispose: function (fn) { 1473 | this._disposeCallback = fn; 1474 | } 1475 | }; 1476 | } 1477 | 1478 | module.bundle.Module = Module; 1479 | 1480 | var parent = module.bundle.parent; 1481 | if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { 1482 | var hostname = '' || location.hostname; 1483 | var protocol = location.protocol === 'https:' ? 'wss' : 'ws'; 1484 | var ws = new WebSocket(protocol + '://' + hostname + ':' + '61590' + '/'); 1485 | ws.onmessage = function (event) { 1486 | var data = JSON.parse(event.data); 1487 | 1488 | if (data.type === 'update') { 1489 | data.assets.forEach(function (asset) { 1490 | hmrApply(global.require, asset); 1491 | }); 1492 | 1493 | data.assets.forEach(function (asset) { 1494 | if (!asset.isNew) { 1495 | hmrAccept(global.require, asset.id); 1496 | } 1497 | }); 1498 | } 1499 | 1500 | if (data.type === 'reload') { 1501 | ws.close(); 1502 | ws.onclose = function () { 1503 | location.reload(); 1504 | }; 1505 | } 1506 | 1507 | if (data.type === 'error-resolved') { 1508 | console.log('[parcel] ✨ Error resolved'); 1509 | } 1510 | 1511 | if (data.type === 'error') { 1512 | console.error('[parcel] 🚨 ' + data.error.message + '\n' + 'data.error.stack'); 1513 | } 1514 | }; 1515 | } 1516 | 1517 | function getParents(bundle, id) { 1518 | var modules = bundle.modules; 1519 | if (!modules) { 1520 | return []; 1521 | } 1522 | 1523 | var parents = []; 1524 | var k, d, dep; 1525 | 1526 | for (k in modules) { 1527 | for (d in modules[k][1]) { 1528 | dep = modules[k][1][d]; 1529 | if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) { 1530 | parents.push(+k); 1531 | } 1532 | } 1533 | } 1534 | 1535 | if (bundle.parent) { 1536 | parents = parents.concat(getParents(bundle.parent, id)); 1537 | } 1538 | 1539 | return parents; 1540 | } 1541 | 1542 | function hmrApply(bundle, asset) { 1543 | var modules = bundle.modules; 1544 | if (!modules) { 1545 | return; 1546 | } 1547 | 1548 | if (modules[asset.id] || !bundle.parent) { 1549 | var fn = new Function('require', 'module', 'exports', asset.generated.js); 1550 | asset.isNew = !modules[asset.id]; 1551 | modules[asset.id] = [fn, asset.deps]; 1552 | } else if (bundle.parent) { 1553 | hmrApply(bundle.parent, asset); 1554 | } 1555 | } 1556 | 1557 | function hmrAccept(bundle, id) { 1558 | var modules = bundle.modules; 1559 | if (!modules) { 1560 | return; 1561 | } 1562 | 1563 | if (!modules[id] && bundle.parent) { 1564 | return hmrAccept(bundle.parent, id); 1565 | } 1566 | 1567 | var cached = bundle.cache[id]; 1568 | if (cached && cached.hot._disposeCallback) { 1569 | cached.hot._disposeCallback(); 1570 | } 1571 | 1572 | delete bundle.cache[id]; 1573 | bundle(id); 1574 | 1575 | cached = bundle.cache[id]; 1576 | if (cached && cached.hot && cached.hot._acceptCallback) { 1577 | cached.hot._acceptCallback(); 1578 | return true; 1579 | } 1580 | 1581 | return getParents(global.require, id).some(function (id) { 1582 | return hmrAccept(global.require, id); 1583 | }); 1584 | } 1585 | },{}]},{},[27,2]) 1586 | //# sourceMappingURL=/dist/basic.map -------------------------------------------------------------------------------- /examples/basic/dist/basic.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["node_modules/lodash-es/_freeGlobal.js","node_modules/lodash-es/_root.js","node_modules/lodash-es/_Symbol.js","node_modules/lodash-es/_getRawTag.js","node_modules/lodash-es/_objectToString.js","node_modules/lodash-es/_baseGetTag.js","node_modules/lodash-es/_overArg.js","node_modules/lodash-es/_getPrototype.js","node_modules/lodash-es/isObjectLike.js","node_modules/lodash-es/isPlainObject.js","node_modules/symbol-observable/es/ponyfill.js","node_modules/symbol-observable/es/index.js","node_modules/redux/es/createStore.js","node_modules/redux/es/utils/warning.js","node_modules/redux/es/combineReducers.js","node_modules/redux/es/bindActionCreators.js","node_modules/redux/es/compose.js","node_modules/redux/es/applyMiddleware.js","node_modules/redux/es/index.js","../../lib/actions.js","../../lib/reducer.js","../../lib/middleware.js","../../lib/index.js","store.js","index.js"],"names":["freeGlobal","global","Object","freeSelf","self","root","Function","Symbol","objectProto","prototype","hasOwnProperty","nativeObjectToString","toString","symToStringTag","toStringTag","undefined","getRawTag","value","isOwn","call","tag","unmasked","e","result","objectToString","nullTag","undefinedTag","baseGetTag","overArg","func","transform","arg","getPrototype","getPrototypeOf","isObjectLike","objectTag","funcProto","funcToString","objectCtorString","isPlainObject","proto","Ctor","constructor","symbolObservablePonyfill","observable","window","module","createStore","ActionTypes","INIT","reducer","preloadedState","enhancer","_ref2","Error","currentReducer","currentState","currentListeners","nextListeners","isDispatching","ensureCanMutateNextListeners","slice","getState","subscribe","listener","isSubscribed","push","unsubscribe","index","indexOf","splice","dispatch","action","type","listeners","i","length","replaceReducer","nextReducer","_ref","outerSubscribe","observer","TypeError","observeState","next","warning","message","console","error","combineReducers","getUndefinedStateErrorMessage","key","actionType","actionName","getUnexpectedStateShapeWarningMessage","inputState","reducers","unexpectedKeyCache","reducerKeys","keys","argumentName","match","join","unexpectedKeys","filter","forEach","assertReducerShape","initialState","Math","random","substring","split","finalReducers","finalReducerKeys","shapeAssertionError","combination","state","arguments","warningMessage","hasChanged","nextState","_i","_key","previousStateForKey","nextStateForKey","errorMessage","bindActionCreators","bindActionCreator","actionCreator","apply","actionCreators","boundActionCreators","compose","_len","funcs","Array","reduce","a","b","applyMiddleware","_extends","assign","target","source","middlewares","store","_dispatch","chain","middlewareAPI","map","middleware","isCrushed","name","defineProperty","exports","STOP_LOADING","START_LOADING","REGISTER_LOADER","UNREGISTER_LOADER","stopLoading","id","payload","startLoading","registerLoader","stopActions","startActions","unregisterLoader","default","_actions","require","_actions2","_interopRequireDefault","obj","__esModule","_defineProperty","enumerable","configurable","writable","omit","blacklist","includes","newObj","reduceArrayToObjectValue","ids","status","acc","INITIAL_STATE","history","loaders","DEFAULT_REDUCER","startActionTypes","stopActionTypes","_id","reduxLoaderMiddleware","reduxLoaderReducer","reduxLoaderActions","_reducer","_reducer2","_middleware","_middleware2","actions","composeEnhancers","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","reduxLoader","btn","document","querySelector","logElem","loading","btn2","loading2","log","className","innerHTML","myLoader","classList","add","remove","myLoader2","registerAction","successAction","failureAction","triggerAction","triggerExample","success","round","setTimeout","onclick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA,IAAIA,aAAa,OAAOC,MAAP,IAAiB,QAAjB,IAA6BA,MAA7B,IAAuCA,OAAOC,MAAP,KAAkBA,MAAzD,IAAmED,MAApF;;kBAEeD;;;;;;;;ACHf;;;;;;AAE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,SAAD,EAAY,SAAZ;AAHN;AAFY,CAAvB;;AASA,IAAMwD,gBAAgB;AACpBnJ,QAAM;AADc,CAAtB;;AAIA,IAAMoJ,gBAAgB;AACpBpJ,QAAM;AADc,CAAtB;;AAIA,IAAMqJ,gBAAgB,EAAErJ,MAAM,mCAAR,EAAtB;;AAEA,gBAAMF,QAAN,CAAeoJ,cAAf;;AAEA,gBAAMpJ,QAAN,CAAe;AACbE,QAAM,wBAAmBoF,eADZ;AAEbI,WAAS;AACPD,QAAI,WADG;AAEPK,kBAAc,CAAC,qCAAD,EAAwC,kBAAxC,CAFP;AAGPD,iBAAa,CAAC,WAAD,EAAc,WAAd;AAHN;AAFI,CAAf;;AASA,IAAM2D,iBAAiB,SAAjBA,cAAiB,CAACD,aAAD,EAAgBF,aAAhB,EAA+BC,aAA/B,EAAiD;AACtE,kBAAMtJ,QAAN,CAAeuJ,aAAf;AACAX,MAAIW,aAAJ;;AAEA,MAAME,UAAUpH,KAAKqH,KAAL,CAAWrH,KAAKC,MAAL,EAAX,CAAhB;;AAEAqH,aAAW,YAAM;AACf,QAAGF,OAAH,EAAY;AACV,sBAAMzJ,QAAN,CAAeqJ,aAAf;AACAT,UAAIS,aAAJ,EAAmB,SAAnB;AACD,KAHD,MAGO;AACL,sBAAMrJ,QAAN,CAAesJ,aAAf;AACAV,UAAIU,aAAJ,EAAmB,SAAnB;AACD;AACF,GARD,EAQG,IARH;AASD,CAfD;;AAiBAjB,IAAIuB,OAAJ,GAAc;AAAA,SAAMJ,eAAeD,aAAf,EAA8BF,aAA9B,EAA6CC,aAA7C,CAAN;AAAA,CAAd;;AAEAZ,KAAKkB,OAAL,GAAe;AAAA,SAAMJ,eAAe;AAClCtJ,UAAM;AAD4B,GAAf,EAElB;AACDA,UAAM;AADL,GAFkB,EAIlB;AACDA,UAAM;AADL,GAJkB,CAAN;AAAA,CAAf","file":"basic.map","sourcesContent":["/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n","import overArg from './_overArg.js';\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nexport default getPrototype;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n","export default function symbolObservablePonyfill(root) {\n\tvar result;\n\tvar Symbol = root.Symbol;\n\n\tif (typeof Symbol === 'function') {\n\t\tif (Symbol.observable) {\n\t\t\tresult = Symbol.observable;\n\t\t} else {\n\t\t\tresult = Symbol('observable');\n\t\t\tSymbol.observable = result;\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n","/* global window */\nimport ponyfill from './ponyfill.js';\n\nvar root;\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = ponyfill(root);\nexport default result;\n","import isPlainObject from 'lodash-es/isPlainObject';\nimport $$observable from 'symbol-observable';\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nexport var ActionTypes = {\n INIT: '@@redux/INIT'\n\n /**\n * Creates a Redux store that holds the state tree.\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n};export default function createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error('Expected the enhancer to be a function.');\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error('Expected the reducer to be a function.');\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n function getState() {\n return currentState;\n }\n\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error('Expected listener to be a function.');\n }\n\n var isSubscribed = true;\n\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n isSubscribed = false;\n\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n };\n }\n\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing “what changed”. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error('Actions may not have an undefined \"type\" property. ' + 'Have you misspelled a constant?');\n }\n\n if (isDispatching) {\n throw new Error('Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error('Expected the nextReducer to be a function.');\n }\n\n currentReducer = nextReducer;\n dispatch({ type: ActionTypes.INIT });\n }\n\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object') {\n throw new TypeError('Expected the observer to be an object.');\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return { unsubscribe: unsubscribe };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n }\n\n // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n dispatch({ type: ActionTypes.INIT });\n\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}","/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\nexport default function warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n /* eslint-disable no-empty */\n } catch (e) {}\n /* eslint-enable no-empty */\n}","import { ActionTypes } from './createStore';\nimport isPlainObject from 'lodash-es/isPlainObject';\nimport warning from './utils/warning';\n\nfunction getUndefinedStateErrorMessage(key, action) {\n var actionType = action && action.type;\n var actionName = actionType && '\"' + actionType.toString() + '\"' || 'an action';\n\n return 'Given action ' + actionName + ', reducer \"' + key + '\" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state. ' + 'If you want this reducer to hold no value, you can return null instead of undefined.';\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n return 'The ' + argumentName + ' has unexpected type of \"' + {}.toString.call(inputState).match(/\\s([a-z|A-Z]+)/)[1] + '\". Expected argument to be an object with the following ' + ('keys: \"' + reducerKeys.join('\", \"') + '\"');\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n\n if (unexpectedKeys.length > 0) {\n return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('\"' + unexpectedKeys.join('\", \"') + '\" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('\"' + reducerKeys.join('\", \"') + '\". Unexpected keys will be ignored.');\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, { type: ActionTypes.INIT });\n\n if (typeof initialState === 'undefined') {\n throw new Error('Reducer \"' + key + '\" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined. If you don\\'t want to set a value for this reducer, ' + 'you can use null instead of undefined.');\n }\n\n var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');\n if (typeof reducer(undefined, { type: type }) === 'undefined') {\n throw new Error('Reducer \"' + key + '\" returned undefined when probed with a random type. ' + ('Don\\'t try to handle ' + ActionTypes.INIT + ' or other actions in \"redux/*\" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined, but can be null.');\n }\n });\n}\n\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\nexport default function combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning('No reducer provided for key \"' + key + '\"');\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n var finalReducerKeys = Object.keys(finalReducers);\n\n var unexpectedKeyCache = void 0;\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError = void 0;\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var action = arguments[1];\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n if (typeof nextStateForKey === 'undefined') {\n var errorMessage = getUndefinedStateErrorMessage(_key, action);\n throw new Error(errorMessage);\n }\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n return hasChanged ? nextState : state;\n };\n}","function bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(undefined, arguments));\n };\n}\n\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass a single function as the first argument,\n * and get a function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\nexport default function bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?');\n }\n\n var keys = Object.keys(actionCreators);\n var boundActionCreators = {};\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var actionCreator = actionCreators[key];\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n return boundActionCreators;\n}","/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\n\nexport default function compose() {\n for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(undefined, arguments));\n };\n });\n}","var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nimport compose from './compose';\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\nexport default function applyMiddleware() {\n for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function (reducer, preloadedState, enhancer) {\n var store = createStore(reducer, preloadedState, enhancer);\n var _dispatch = store.dispatch;\n var chain = [];\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch(action) {\n return _dispatch(action);\n }\n };\n chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(undefined, chain)(store.dispatch);\n\n return _extends({}, store, {\n dispatch: _dispatch\n });\n };\n };\n}","import createStore from './createStore';\nimport combineReducers from './combineReducers';\nimport bindActionCreators from './bindActionCreators';\nimport applyMiddleware from './applyMiddleware';\nimport compose from './compose';\nimport warning from './utils/warning';\n\n/*\n* This is a dummy function to check if the function name has been altered by minification.\n* If the function has been minified and NODE_ENV !== 'production', warn the user.\n*/\nfunction isCrushed() {}\n\nif (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {\n warning('You are currently using minified code outside of NODE_ENV === \\'production\\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');\n}\n\nexport { createStore, combineReducers, bindActionCreators, applyMiddleware, compose };","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar STOP_LOADING = exports.STOP_LOADING = '@@RL/STOP_LOADING';\nvar START_LOADING = exports.START_LOADING = '@@RL/START_LOADING';\nvar REGISTER_LOADER = exports.REGISTER_LOADER = '@@RL/REGISTER_LOADER';\nvar UNREGISTER_LOADER = exports.UNREGISTER_LOADER = '@@RL/UNREGISTER_LOADER';\n\nvar stopLoading = exports.stopLoading = function stopLoading(id) {\n return {\n type: STOP_LOADING,\n payload: id\n };\n};\n\nvar startLoading = exports.startLoading = function startLoading(id) {\n return {\n type: START_LOADING,\n payload: id\n };\n};\n\nvar registerLoader = exports.registerLoader = function registerLoader(_ref) {\n var id = _ref.id,\n stopActions = _ref.stopActions,\n startActions = _ref.startActions;\n return {\n type: REGISTER_LOADER,\n payload: {\n id: id,\n stopActions: stopActions,\n startActions: startActions\n }\n };\n};\n\nvar unregisterLoader = exports.unregisterLoader = function unregisterLoader(id) {\n return {\n type: UNREGISTER_LOADER,\n payload: id\n };\n};\n\nexports.default = {\n // Actions\n STOP_LOADING: STOP_LOADING,\n START_LOADING: START_LOADING,\n REGISTER_LOADER: REGISTER_LOADER,\n UNREGISTER_LOADER: UNREGISTER_LOADER,\n\n // Action creators\n stopLoading: stopLoading,\n startLoading: startLoading,\n registerLoader: registerLoader,\n unregisterLoader: unregisterLoader\n};","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _actions = require('./actions');\n\nvar _actions2 = _interopRequireDefault(_actions);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar omit = function omit() {\n var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var blacklist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n return Object.keys(obj).filter(function (key) {\n return !blacklist.includes(key);\n }).reduce(function (newObj, key) {\n return _extends({}, newObj, _defineProperty({}, key, obj[key]));\n }, {});\n};\n\nvar reduceArrayToObjectValue = function reduceArrayToObjectValue() {\n var ids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n return ids.reduce(function (acc, id) {\n return _extends({}, acc, _defineProperty({}, id, status));\n }, {});\n};\n\nvar INITIAL_STATE = {\n history: {},\n loaders: {},\n startActions: {},\n stopActions: {}\n};\n\nvar reducer = function reducer() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_STATE;\n var action = arguments[1];\n\n switch (action.type) {\n case _actions2.default.REGISTER_LOADER:\n return _extends({}, state, {\n loaders: _extends({}, state.loaders, _defineProperty({}, action.payload.id, false)),\n startActions: _extends({}, state.startActions, reduceArrayToObjectValue(action.payload.startActions, action.payload.id)),\n stopActions: _extends({}, state.stopActions, reduceArrayToObjectValue(action.payload.stopActions, action.payload.id)),\n history: _extends({}, state.history, _defineProperty({}, action.payload.id, action.payload))\n });\n case _actions2.default.UNREGISTER_LOADER:\n return _extends({}, state, {\n history: omit(state.history, action.payload),\n loaders: omit(state.loaders, action.payload),\n startActions: omit(state.startActions, state.history[action.payload].startActions),\n stopActions: omit(state.stopActions, state.history[action.payload].stopActions)\n });\n case _actions2.default.START_LOADING:\n return _extends({}, state, {\n loaders: _extends({}, state.loaders, _defineProperty({}, action.payload, true))\n });\n case _actions2.default.STOP_LOADING:\n return _extends({}, state, {\n loaders: _extends({}, state.loaders, _defineProperty({}, action.payload, false))\n });\n default:\n return state;\n }\n};\n\nexports.default = reducer;","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _actions = require('./actions');\n\nvar _actions2 = _interopRequireDefault(_actions);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar DEFAULT_REDUCER = 'reduxLoader';\n\nvar middleware = function middleware() {\n var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_REDUCER;\n return function (store) {\n return function (next) {\n return function (action) {\n var state = store.getState()[key];\n\n if (state) {\n next(action);\n\n var startActions = state.startActions || {};\n var startActionTypes = Object.keys(startActions);\n\n var stopActions = state.stopActions || {};\n var stopActionTypes = Object.keys(stopActions);\n\n if (startActionTypes.includes(action.type)) {\n var id = startActions[action.type];\n\n return next({\n type: _actions2.default.START_LOADING,\n payload: id\n });\n }\n\n if (stopActionTypes.includes(action.type)) {\n var _id = stopActions[action.type];\n\n return next({\n type: _actions2.default.STOP_LOADING,\n payload: _id\n });\n }\n\n return;\n }\n\n return next(action);\n };\n };\n };\n};\n\nexports.default = middleware;","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.reduxLoaderMiddleware = exports.reduxLoaderReducer = exports.reduxLoaderActions = undefined;\n\nvar _reducer = require('./reducer');\n\nvar _reducer2 = _interopRequireDefault(_reducer);\n\nvar _actions = require('./actions');\n\nvar _actions2 = _interopRequireDefault(_actions);\n\nvar _middleware = require('./middleware');\n\nvar _middleware2 = _interopRequireDefault(_middleware);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.reduxLoaderActions = _actions2.default;\nexports.reduxLoaderReducer = _reducer2.default;\nexports.reduxLoaderMiddleware = _middleware2.default;\nexports.default = { actions: _actions2.default, reducer: _reducer2.default, middleware: _middleware2.default };","import { applyMiddleware, createStore, compose, combineReducers } from 'redux';\n\nimport { reduxLoaderReducer, reduxLoaderMiddleware } from '../../lib';\n\nconst composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;\nconst enhancer = composeEnhancers(applyMiddleware(reduxLoaderMiddleware()));\n\nconst reducer = combineReducers({\n reduxLoader: reduxLoaderReducer,\n});\n\nconst store = createStore(reducer, enhancer);\n\nexport default store;\n","import store from './store';\nimport { reduxLoaderActions } from '../../lib';\n\nconst btn = document.querySelector('.button');\nconst logElem = document.querySelector('.logs');\nconst loading = document.querySelector('.loading');\n\nconst btn2 = document.querySelector('.button2');\nconst loading2 = document.querySelector('.loading2');\n\nconst log = (action, className = '') => {\n logElem.innerHTML += `
  • ${action.type}
  • `;\n};\n\nstore.subscribe(() => {\n if (store.getState().reduxLoader.loaders.myLoader) {\n loading.classList.add('show');\n } else {\n loading.classList.remove('show');\n }\n\n if (store.getState().reduxLoader.loaders.myLoader2) {\n loading2.classList.add('show');\n } else {\n loading2.classList.remove('show');\n }\n});\n\nconst registerAction = {\n type: reduxLoaderActions.REGISTER_LOADER,\n payload: {\n id: 'myLoader',\n startActions: ['SOME_ACTION_THAT_TRIGGERS_LOADING', 'ANOTHER_ACTION'],\n stopActions: ['SUCCESS', 'FAILURE'],\n },\n};\n\nconst successAction = {\n type: 'SUCCESS',\n};\n\nconst failureAction = {\n type: 'FAILURE',\n};\n\nconst triggerAction = { type: 'SOME_ACTION_THAT_TRIGGERS_LOADING' };\n\nstore.dispatch(registerAction);\n\nstore.dispatch({\n type: reduxLoaderActions.REGISTER_LOADER,\n payload: {\n id: 'myLoader2',\n startActions: ['SOME_ACTION_THAT_TRIGGERS_LOADING_2', 'ANOTHER_ACTION_2'],\n stopActions: ['SUCCESS_2', 'FAILURE_2'],\n },\n});\n\nconst triggerExample = (triggerAction, successAction, failureAction) => {\n store.dispatch(triggerAction);\n log(triggerAction);\n\n const success = Math.round(Math.random());\n\n setTimeout(() => {\n if(success) {\n store.dispatch(successAction);\n log(successAction, 'success');\n } else {\n store.dispatch(failureAction);\n log(failureAction, 'failure');\n }\n }, 1500);\n};\n\nbtn.onclick = () => triggerExample(triggerAction, successAction, failureAction);\n\nbtn2.onclick = () => triggerExample({\n type: 'ANOTHER_ACTION_2',\n}, {\n type: 'SUCCESS_2',\n}, {\n type: 'FAILURE_2',\n});\n"]} --------------------------------------------------------------------------------