m4d_flux library

MdlFlux implements unidirectional flow in contrast to popular frameworks such as Angular or Ember. Even though two-directional bindings can be convenient, they come with a cost. It can be hard to deduce what's going on and why.

When we trigger the action, the dispatcher will get notified. The dispatcher will be able to deal with possible store dependencies. It is possible that certain action needs to happen before another. Dispatcher allows us to achieve this.

At the simplest level, actions can just pass the message to dispatcher as is. They can also trigger asynchronous queries and hit dispatcher based on the result eventually. This allows us to deal with received data and possible errors.

Once the dispatcher has dealt with the action, stores that are listening to it get triggered. As a result, it will be able to update its internal state. After doing this it will notify possible listeners of the new state.

This completes the basic unidirectional, yet linear, process flow of MdlFlux. Usually, though, the unidirectional process has a cyclical flow and it doesn't necessarily end. The following diagram illustrates a more common flow.

It is the same idea again, but with the addition of a returning cycle. Eventually the components depending our our store data become refreshed through this looping process.

More infos about flux:

Classes

Action
Simples form of an Action [...]
ActionBus
Main-Class for sending Actions
ActionBusImpl
Implements the ActionBus-interface via Streams ActionBus is registered by default for DI [...]
ActionName
Strong-Typed ActionName [...]
DataAction<T>
This Action carries a data-package [...]
DataStore
The DataStores are responsible for managing business logic and data. [...]
DataStoreChangedEvent<T extends Action>
Received by a concrete implementation of DataStore if something has changed in the DataStore
Dispatcher
The Dispatcher is the central hub that manages all data flow in a MDL(Flux) application. [...]
Emitter
This is the base class for DataStore so it's not really a DataStore but if you need an object that informs others about an internat change-state the Emitter can help you [...]
FireOnlyDataStore
Fire-Only DataStore [...]
FromJson
Marker for all objects that can be deserialize from Json
JsonAction<T extends ToJson>
This Action carries a special data-package. The data-package can be serialized to JSON [...]
JsonObject
Marker for all objects that can be serialized and deserialize from Json
ToJson
Marker for all objects that can be serialized to Json
ToJsonEvent<T extends ToJson>
Creates a JSON-Map [...]
UpdateView
Stock-Action that is emitted by the Dispatcher.emitChange-Function

Constants

UpdateViewAction → const UpdateView
const UpdateView()

Enums

ActionType
Gives you more infos about the action you receive [...]