redux-thunks
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -8,8 +8,18 @@ "use strict"; | ||
function createThunk(type, fn) { | ||
const actionCreator = (...args) => (dispatch, getState) => fn({ dispatch, getState, type }, ...args); | ||
var actionCreator = function actionCreator() { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return function (dispatch, getState) { | ||
return fn.apply(undefined, [{ dispatch: dispatch, getState: getState, type: type }].concat(args)); | ||
}; | ||
}; | ||
// mimic redux-actions' .toString() functionality | ||
actionCreator.toString = () => type.toString(); | ||
actionCreator.toString = function () { | ||
return type.toString(); | ||
}; | ||
return actionCreator; | ||
} |
{ | ||
"name": "redux-thunks", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Thunk creator for redux", | ||
@@ -33,3 +33,7 @@ "main": "cjs/index.js", | ||
"targets": { | ||
"node": 6 | ||
"node": 6, | ||
"browsers": [ | ||
"last 2 versions", | ||
"ie >= 11" | ||
] | ||
} | ||
@@ -36,0 +40,0 @@ } |
@@ -74,3 +74,3 @@ # redux-thunks | ||
#### `createThunk('type', ({ dispatch, getStore, type }, [...args]))` | ||
#### `createThunk('type', ({ dispatch, getState, type }, [...args]))` | ||
@@ -77,0 +77,0 @@ The syntax is very similar to that of `createAction`, and it smooths over the differences by similarly exposing a `toString` method on the thunk creator. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7526
38