lager::
make_store
(Model &&init, EventLoop &&loop, Enhancers&&... enhancers)¶Builds a lager::store
that glues together the core components of an interactive application following an unidirectional data flow architecture.
Action
: Value type that represents an event (an interaction) happening in the application.Tag
: Use automatic_tag
to indicate that the store should automatically make changes visible notified after every action is processed. Use transactional_tag
to require a lager::commit
call for that.init
: Initial value of the data-model. It should be a value-type.loop
: Event loop in which operations can be scheduled. This allows thread-safe action dispatching reusing the technology provided by the UI framework at hand (it does not need to be the event-loop of a UI framework.)enhancer
: Optional middleware that enhances or modified the applications behavior in a general way.Note
The term reducer is due to the fact that, if we consider the sequence of actions over time, this function “reduces” the sequence to a single model value. This is a pure function and it should have no side-effects—it takes a model value with the current state of the world, and it should return a new model value with the updated state of the world. If we evaluate the function with the same arguments, it should always return exactly the same arguments. If, given the current action, it decides that some side-effects are required (reading or writing files, generating random numbers, making network requests, etc.) it should use the second signature, which allows to schedule side-effects.
lager::
make_store
(Model &&init, EventLoop &&loop)¶lager::
with_deps
(Args&&... args)¶Store enhancer that adds dependencies to the store.
make_deps()
. lager::
store
¶Stores the data model for and glues together the components to observe and update it.
lager::make_store
for details about the different initialization components. Inherits from lager::context< Action, Dependencies >, lager::reader_base< detail::store_node_base< Action, Model > >
Public Functions
store
(model_t init, ReducerFn reducer, EventLoop loop, Deps dependencies, Tags tags)¶Friends
lager::store::detail::access