-
Notifications
You must be signed in to change notification settings - Fork 37
[Deprecated] Architecture
Vojta Smrcek edited this page Sep 7, 2018
·
1 revision
General diagram of the FluxC architecture:
The dispatcher is the central piece of communication between the app, stores and network clients. It acts like an event bus (it's currently just an event bus wrapper).
Notes:
- WP REST API client is not implemented yet (we have a proof of concept and discovery utils).
- Memory storage is optional, it makes sense to have some data in memory so we don't have to hit the DB everytime we call a Store's getter. The Account Store is currently the only Store using data stored in memory.
An app based on FluxC communicates via different channels:
- App sends actions. Actions are interpreted by one or multiple Stores.
- Stores generate events. Some events might be observed by the app.
- App gets data from Stores.
Example:
- App asks FluxC to
FETCH_SITE
for site X. The SiteStore is listening for thisFETCH_SITE
action, will trigger a call to the XMLRPC or REST client depending of site X. - Network client receive a response from the server and notify the SiteStore. The SiteStore updates the site in the DB and generates an
OnSiteChanged
event. The app is listening forOnSiteChanged
events. - App gets updated site by calling the
getSiteByLocalId()
getter on the SiteStore.