This commit is contained in:
41
node_modules/redux-thunk/dist/redux-thunk.js
generated
vendored
Normal file
41
node_modules/redux-thunk/dist/redux-thunk.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ReduxThunk = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
/** A function that accepts a potential "extra argument" value to be injected later,
|
||||
* and returns an instance of the thunk middleware that uses that value
|
||||
*/
|
||||
function createThunkMiddleware(extraArgument) {
|
||||
// Standard Redux middleware definition pattern:
|
||||
// See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware
|
||||
var middleware = function middleware(_ref) {
|
||||
var dispatch = _ref.dispatch,
|
||||
getState = _ref.getState;
|
||||
return function (next) {
|
||||
return function (action) {
|
||||
// The thunk middleware looks for any functions that were passed to `store.dispatch`.
|
||||
// If this "action" is really a function, call it and return the result.
|
||||
if (typeof action === 'function') {
|
||||
// Inject the store's `dispatch` and `getState` methods, as well as any "extra arg"
|
||||
return action(dispatch, getState, extraArgument);
|
||||
} // Otherwise, pass the action down the middleware chain as usual
|
||||
|
||||
|
||||
return next(action);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
return middleware;
|
||||
}
|
||||
|
||||
var thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version
|
||||
// with whatever "extra arg" they want to inject into their thunks
|
||||
|
||||
thunk.withExtraArgument = createThunkMiddleware;
|
||||
|
||||
return thunk;
|
||||
|
||||
}));
|
||||
1
node_modules/redux-thunk/dist/redux-thunk.min.js
generated
vendored
Normal file
1
node_modules/redux-thunk/dist/redux-thunk.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).ReduxThunk=t()}(this,(function(){"use strict";function e(e){return function(t){var n=t.dispatch,u=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,u,e):t(o)}}}}var t=e();return t.withExtraArgument=e,t}));
|
||||
Reference in New Issue
Block a user