Skip to content

Commit

Permalink
Docs: Add note about plugin opt-in for controls
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Aug 6, 2018
1 parent 5d9b7ad commit a675f49
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ The `resolvers` option should be passed as an object where each key is the name

### `controls`

_**Note:** Controls are an opt-in feature, enabled via `use` (the [Plugins API](https://github.com/WordPress/gutenberg/tree/master/packages/data/src/plugins))._

A **control** defines the execution flow behavior associated with a specific action type. This can be particularly useful in implementing asynchronous data flows for your store. By defining your action creator or resolvers as a generator which yields specific controlled action types, the execution will proceed as defined by the control handler.

The `controls` option should be passed as an object where each key is the name of the action type to act upon, the value a function which receives the original action object. It should 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.
Expand Down

0 comments on commit a675f49

Please sign in to comment.