-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JSDoc annotations to the public API #300
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import createStore from './createStore'; | ||
import compose from './utils/compose'; | ||
import combineReducers from './utils/combineReducers'; | ||
import bindActionCreators from './utils/bindActionCreators'; | ||
import applyMiddleware from './utils/applyMiddleware'; | ||
import compose from './utils/compose'; | ||
|
||
export { | ||
createStore, | ||
compose, | ||
combineReducers, | ||
bindActionCreators, | ||
applyMiddleware | ||
applyMiddleware, | ||
compose | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
import compose from './compose'; | ||
|
||
/** | ||
* Creates a higher-order store that applies middleware to a store's dispatch. | ||
* Creates a higher-order store that applies middleware to the dispatch method | ||
* of the Redux store. This is handy for a variety of tasks, such as expressing | ||
* asynchronous actions in a concise manner, or logging every action payload. | ||
* | ||
* See `redux-thunk` package as an example of the Redux middleware. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. For now I'd avoid hardcoding URL because we might move that package to a separate Github organization soon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's probably wise |
||
* | ||
* Because middleware is potentially asynchronous, this should be the first | ||
* higher-order store in the composition chain. | ||
* @param {...Function} ...middlewares | ||
* @return {Function} A higher-order store | ||
* | ||
* @param {...Function} middlewares The middleware chain to be applied. | ||
* @returns {Function} A higher-order store. | ||
*/ | ||
export default function applyMiddleware(...middlewares) { | ||
return (next) => (reducer, initialState) => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good way to document callbacks is to use the
@callback
tag. This way you can document the@params
of the callback function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I didn't know this! Want to send a PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I don't really have time tonight though. Guess I can do it after the merge?
Edit: Oh, its merged already ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah feel free to make a PR against
breaking-changes-1.0
branch.