diff --git a/bin/update-readmes.js b/bin/update-readmes.js index 7cbaa4274da27..a227c6373570c 100755 --- a/bin/update-readmes.js +++ b/bin/update-readmes.js @@ -27,7 +27,7 @@ const packages = [ 'keycodes', //'plugins', 'priority-queue', - //'redux-routine', + 'redux-routine', 'rich-text', 'shortcode', 'url', diff --git a/packages/redux-routine/README.md b/packages/redux-routine/README.md index 5484b7ec35c57..46c9b299b3104 100644 --- a/packages/redux-routine/README.md +++ b/packages/redux-routine/README.md @@ -57,9 +57,29 @@ request has completed does the action creator procede to return the `SET_TEMPERA ## API -### `createMiddleware( controls: ?Object )` + -Create a Redux middleware, given an object of controls where each key is an action type for which to act upon, the value a function which returns either a promise which is to resolve when evaluation of the action should continue, or a value. The value or resolved promise value is assigned on the return value of the yield assignment. If the control handler returns undefined, the execution is not continued. +### default + +[src/index.js#L19-L30](src/index.js#L19-L30) + +Creates a Redux middleware, given an object of controls where each key is an +action type for which to act upon, the value a function which returns either +a promise which is to resolve when evaluation of the action should continue, +or a value. The value or resolved promise value is assigned on the return +value of the yield assignment. If the control handler returns undefined, the +execution is not continued. + +**Parameters** + +- **controls** `Object`: Object of control handlers. + +**Returns** + +`Function`: Co-routine runtime + + + ## Motivation @@ -67,9 +87,9 @@ Create a Redux middleware, given an object of controls where each key is an acti The primary motivations include, among others: -- **Testability**: Since an action creator yields plain action objects, the behavior of their resolution can be easily substituted in tests. -- **Controlled flexibility**: Control flows can be implemented without sacrificing the expressiveness and intentionality of an action type. Other solutions like thunks or promises promote ultimate flexibility, but at the expense of maintainability manifested through deep coupling between action types and incidental implementation. -- A **common domain language** for expressing data flows: Since controls are centrally defined, it requires the conscious decision on the part of a development team to decide when and how new control handlers are added. +- **Testability**: Since an action creator yields plain action objects, the behavior of their resolution can be easily substituted in tests. +- **Controlled flexibility**: Control flows can be implemented without sacrificing the expressiveness and intentionality of an action type. Other solutions like thunks or promises promote ultimate flexibility, but at the expense of maintainability manifested through deep coupling between action types and incidental implementation. +- A **common domain language** for expressing data flows: Since controls are centrally defined, it requires the conscious decision on the part of a development team to decide when and how new control handlers are added. ## Testing