Actions
Create actions by extending from the base Actions
class.
You can also use a plain JavaScript object. When passed to flux.createActions
, it will be converted into an Actions class.
Testing
The return value of an action is dispatched automatically. It's also returned to the caller. This means it's possible to test actions completely independently from a Flux or Store instance. Here's how you'd test the example MessageActions from above:
Asynchronous actions
Asynchronous actions are actions that return promises. Unlike synchronous actions, async actions fire the dispatcher twice: at the beginning and at the end of the action. Refer to the Store API for information on how to register handlers for asynchronous actions.
Methods
getActionIds
Returns an object of action ids, keyed by action name. (In most cases, it's probably more convenient to use Flux#getActionIds()
instead.)
Also available as getConstants()