redux-promise-middleware
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -21,4 +21,6 @@ 'use strict'; | ||
var promiseTypeSuffixes = config.promiseTypeSuffixes || defaultTypes; | ||
return function (_ref) { | ||
var dispatch = _ref.dispatch; | ||
return function (next) { | ||
@@ -50,2 +52,6 @@ return function (action) { | ||
var isActionOrThunk = function isActionOrThunk(resolved) { | ||
return typeof resolved === 'function' || resolved.meta || resolved.payload; | ||
}; | ||
/** | ||
@@ -59,3 +65,3 @@ * Return either the fulfilled action object or the rejected | ||
type: type + '_' + FULFILLED | ||
}, resolved.meta || resolved.payload ? resolved : _extends({}, resolved && { payload: resolved }, meta && { meta: meta }))); | ||
}, isActionOrThunk(resolved) ? resolved : _extends({}, resolved && { payload: resolved }, meta && { meta: meta }))); | ||
}, function (error) { | ||
@@ -62,0 +68,0 @@ return dispatch(_extends({ |
{ | ||
"name": "redux-promise-middleware", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Redux middleware for handling promises", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"test": "`npm bin`/eslint ./src/*.js", | ||
"pretest": "`npm bin`/eslint ./src/*.js", | ||
"test": "mocha --compilers js:babel/register --reporter spec test/*.js", | ||
"prepublish": "npm test && make js" | ||
@@ -29,5 +30,9 @@ }, | ||
"babel-eslint": "^3.1.23", | ||
"chai": "^3.4.0", | ||
"eslint": "^0.24.1", | ||
"eslint-config-airbnb": "0.0.6", | ||
"eslint-plugin-react": "^2.7.0" | ||
"eslint-plugin-react": "^2.7.0", | ||
"mocha": "^2.3.3", | ||
"redux": "^3.0.4", | ||
"redux-mock-store": "0.0.2" | ||
}, | ||
@@ -34,0 +39,0 @@ "peerDependencies": { |
# Redux Promise Middleware | ||
[![npm version](https://img.shields.io/npm/v/redux-promise-middleware.svg?style=flat-square)](https://www.npmjs.com/package/redux-promise-middleware) | ||
[![npm version](https://img.shields.io/npm/v/redux-promise-middleware.svg?style=flat)](https://www.npmjs.com/package/redux-promise-middleware) [![Build Status](https://travis-ci.org/pburtchaell/redux-promise-middleware.svg)](https://travis-ci.org/pburtchaell/redux-promise-middleware) [![npm downloads](https://img.shields.io/npm/dm/redux-promise-middleware.svg?style=flat)](https://www.npmjs.com/package/redux-promise-middleware) | ||
@@ -40,2 +40,10 @@ # Getting Started | ||
## What is the difference between this and other promise middleware? | ||
In issue [#27](https://github.com/pburtchaell/redux-promise-middleware/issues/27), it was asked if this middleware is the same as [acdlite/redux-promise](https://github.com/acdlite/redux-promise). The short answer is that while the middleware solve the same problem, the implementation is different. | ||
The major difference is this middleware dispatches a `_PENDING` action. The pending action enables optimistic updates and provides an action one can use to update the user interface to inform the user a request is being made. This is a feature that acdlite/redux-promise has not implemented at time of writing this (November 2015). A similarity is that both middleware use the [Flux Standard Action](https://github.com/acdlite/flux-standard-action) specification. | ||
One could also argue the API for this middleware is more transparent and easier to integrate, e.g., you do not need to use [redux-actions](https://github.com/acdlite/redux-actions). | ||
## Type Suffix Configuration | ||
@@ -48,3 +56,3 @@ | ||
promiseMiddleware({ | ||
promiseTypeSuffixes: ['START', 'SUCCESS', 'ERROR'] | ||
promiseTypeSuffixes: ['LOADING', 'SUCCESS', 'ERROR'] | ||
}) | ||
@@ -65,3 +73,3 @@ ) | ||
meta: { | ||
promiseTypeSuffixes: ['WAIT', 'YAY', '!@£$'] | ||
promiseTypeSuffixes: ['PENDING', 'H*LL_YEAH', 'SH*T'] | ||
} | ||
@@ -68,0 +76,0 @@ }; |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
22930
32
512
79
9
1