redux-thunk
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -55,3 +55,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/* 0 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -61,5 +61,5 @@ module.exports = __webpack_require__(1); | ||
/***/ }, | ||
/***/ }), | ||
/* 1 */ | ||
/***/ function(module, exports) { | ||
/***/ (function(module, exports) { | ||
@@ -90,5 +90,5 @@ 'use strict'; | ||
/***/ } | ||
/***/ }) | ||
/******/ ]) | ||
}); | ||
; |
@@ -1,18 +0,20 @@ | ||
import {Middleware, Dispatch} from "redux"; | ||
import { Middleware, Action, AnyAction } from "redux"; | ||
export interface ThunkDispatch<S, E, A extends Action> { | ||
<T extends A>(action: T): T; | ||
<R>(asyncAction: ThunkAction<R, S, E, A>): R; | ||
} | ||
export type ThunkAction<R, S, E> = (dispatch: Dispatch<S>, getState: () => S, | ||
extraArgument: E) => R; | ||
export type ThunkAction<R, S, E, A extends Action> = ( | ||
dispatch: ThunkDispatch<S, E, A>, | ||
getState: () => S, | ||
extraArgument: E | ||
) => R; | ||
declare module "redux" { | ||
export interface Dispatch<S> { | ||
<R, E>(asyncAction: ThunkAction<R, S, E>): R; | ||
} | ||
export type ThunkMiddleware<S = {}, A extends Action = AnyAction, E = undefined> = Middleware<ThunkDispatch<S, E, A>, S, ThunkDispatch<S, E, A>>; | ||
declare const thunk: ThunkMiddleware & { | ||
withExtraArgument<E>(extraArgument: E): ThunkMiddleware<{}, AnyAction, E> | ||
} | ||
declare const thunk: Middleware & { | ||
withExtraArgument(extraArgument: any): Middleware; | ||
}; | ||
export default thunk; |
The MIT License (MIT) | ||
Copyright (c) 2015 Dan Abramov | ||
Copyright (c) 2015-present Dan Abramov | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "redux-thunk", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"license": "MIT", | ||
"description": "Thunk middleware for Redux.", | ||
"repository": "github:reduxjs/redux-thunk", | ||
"bugs": "https://github.com/reduxjs/redux-thunk/issues", | ||
"homepage": "https://github.com/reduxjs/redux-thunk", | ||
"keywords": [ | ||
"redux", | ||
"thunk", | ||
"middleware", | ||
"redux-middleware", | ||
"flux" | ||
], | ||
"author": "Dan Abramov <dan.abramov@me.com>", | ||
"main": "lib/index.js", | ||
"jsnext:main": "es/index.js", | ||
"module": "es/index.js", | ||
"typings": "./index.d.ts", | ||
@@ -17,7 +29,6 @@ "files": [ | ||
"clean": "rimraf lib dist es", | ||
"build": "npm run build:commonjs && npm run build:umd && npm run build:umd:min && npm run build:es", | ||
"prepublish": "npm run clean && npm run test && npm run build", | ||
"posttest": "npm run lint", | ||
"prepare": "npm run clean && npm run lint && npm run test && npm run build", | ||
"lint": "eslint src test", | ||
"test": "cross-env BABEL_ENV=commonjs mocha --compilers js:babel-core/register --reporter spec test/*.js", | ||
"build": "npm run build:commonjs && npm run build:umd && npm run build:umd:min && npm run build:es", | ||
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib", | ||
@@ -28,16 +39,2 @@ "build:es": "cross-env BABEL_ENV=es babel src --out-dir es", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/gaearon/redux-thunk.git" | ||
}, | ||
"homepage": "https://github.com/gaearon/redux-thunk", | ||
"keywords": [ | ||
"redux", | ||
"thunk", | ||
"middleware", | ||
"redux-middleware", | ||
"flux" | ||
], | ||
"author": "Dan Abramov <dan.abramov@me.com>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
@@ -74,8 +71,8 @@ "babel-cli": "^6.6.5", | ||
"mocha": "^2.2.5", | ||
"redux": "^3.4.0", | ||
"redux": "~4.0.0", | ||
"rimraf": "^2.5.2", | ||
"typescript": "^1.8.10", | ||
"typescript-definition-tester": "0.0.4", | ||
"typescript": "~2.6.2", | ||
"typings-tester": "^0.3.1", | ||
"webpack": "^1.12.14" | ||
} | ||
} |
Redux Thunk | ||
============= | ||
Thunk [middleware](http://redux.js.org/docs/advanced/Middleware.html) for Redux. | ||
Thunk [middleware](https://redux.js.org/advanced/middleware) for Redux. | ||
[![build status](https://img.shields.io/travis/gaearon/redux-thunk/master.svg?style=flat-square)](https://travis-ci.org/gaearon/redux-thunk) | ||
[![build status](https://img.shields.io/travis/reduxjs/redux-thunk/master.svg?style=flat-square)](https://travis-ci.org/reduxjs/redux-thunk) | ||
[![npm version](https://img.shields.io/npm/v/redux-thunk.svg?style=flat-square)](https://www.npmjs.com/package/redux-thunk) | ||
@@ -17,3 +17,3 @@ [![npm downloads](https://img.shields.io/npm/dm/redux-thunk.svg?style=flat-square)](https://www.npmjs.com/package/redux-thunk) | ||
Most tutorials today assume Redux Thunk 1.x so you might run into an issue when running their code with 2.x. | ||
**If you use Redux Thunk 2.x in CommonJS environment, [don’t forget to add `.default` to your import](https://github.com/gaearon/redux-thunk/releases/tag/v2.0.0):** | ||
**If you use Redux Thunk 2.x in CommonJS environment, [don’t forget to add `.default` to your import](https://github.com/reduxjs/redux-thunk/releases/tag/v2.0.0):** | ||
@@ -31,3 +31,3 @@ ```diff | ||
Additionally, since 2.x, we also support a [UMD build](https://npmcdn.com/redux-thunk@2.0.1/dist/redux-thunk.min.js): | ||
Additionally, since 2.x, we also support a [UMD build](https://unpkg.com/redux-thunk/dist/redux-thunk.min.js): | ||
@@ -102,2 +102,3 @@ ```js | ||
The term [originated](https://en.wikipedia.org/wiki/Thunk#cite_note-1) as a humorous past-tense version of "think". | ||
@@ -110,3 +111,3 @@ ## Installation | ||
Then, to enable Redux Thunk, use [`applyMiddleware()`](http://redux.js.org/docs/api/applyMiddleware.html): | ||
Then, to enable Redux Thunk, use [`applyMiddleware()`](https://redux.js.org/api-reference/applymiddleware): | ||
@@ -269,6 +270,6 @@ ```js | ||
componentWillReceiveProps(nextProps) { | ||
if (nextProps.forPerson !== this.props.forPerson) { | ||
componentDidUpdate(prevProps) { | ||
if (prevProps.forPerson !== this.props.forPerson) { | ||
this.props.dispatch( | ||
makeASandwichWithSecretSauce(nextProps.forPerson) | ||
makeASandwichWithSecretSauce(this.props.forPerson) | ||
); | ||
@@ -319,3 +320,3 @@ } | ||
return (dispatch, getState, { api, whatever }) => { | ||
// you can use api and something else here here | ||
// you can use api and something else here | ||
} | ||
@@ -322,0 +323,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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
17691
130
324
1
1