Comments (7)
After some rethinking... Are you already doing exactly this?
I would say your Mediator already is the Component but the @actions method is what triggers the single Mediator.
Maybe it would even be sufficient to rename the Mediator to Component?
And then inside of the Component you would have s.th. like
@mediator.publish('eventName', {some: data});
from ui.
Hey there, I am on holidays until Sunday - i will answer next week
from ui.
Yes I know, it is more a reminder for our call ;)
from ui.
Hey @DerMambo, I am back in town re-united with my Laptop after a great holiday trip to Budapest
Ok let me explain how space:ui
works in Chaplin terms:
- Application: This is your Space.Application that is responsible to map, configure and initialize everything that exists in your whole app. Without it, nothing would be instantiated or mapped into the dependency injection system.
- Router / Layout: You can use any package you want, it only has to use the standard Meteor Blaze templates for rendering. Currently I am using
iron:router
for that purpose, butspace:ui
has no dependency on it. - Dispatcher / Controller: There is no concept of "screen" or "one controller per screen" in
space:ui
since it follows the philosophy of React.js and Flow. That means that there are dumb, composableviews
(in our case these are plain Meteor templates) and for some (higher-level) regions there aremediators
that know how to provide data to their managed views. - Models / Views: There are no models and views in the classic sense. The only place where data is manipulated and prepared for the rest of the app are
stores
. The views are just simple meteor templates that get their data from some mediator (but don't know that – they just access the data over some variable likestate
)
from ui.
To clarify your confusion about @actions
:
There is exactly one Dispatcher
for your whole application which works like a simple event bus. So you could get a reference to that anywhere by declaring dispatcher: 'Space.ui.Dispatcher'
as a dependency. Then you can broadcast an action by calling @dispatcher.dispatch
with a plain object. There is no filtering system or anything, it just gets broadcasted to any listener in your app – They can decide if they are interested in the action by looking on the payload object. The reason for this is simple: There are not many listeners, most commonly there are only a few stores that react to actions. All other parts of you application (e.g. mediators
/ views
) are updated "magically" via the Meteor reactive Tracker
. So your mediators / views dont need to listen to these actions (and they shouldn't have to).
The @actions
pattern is just a simplification of the whole process, so you dont have to always get a reference to the dispatcher and do the whole ceremony. The actions are just pre-configured functions that internally do that for you – you can just provide them the stuff you want to broadcast
from ui.
Thx by the way! :)
from ui.
You are welcome
from ui.
Related Issues (20)
- No mapping for identifier <Space.Application.Injector> was found HOT 13
- getState and setState HOT 30
- this in templateRendered HOT 9
- Stores are not initialized on the app start HOT 6
- Example does not work HOT 1
- Using store.getState('key') also reruns the reactive context when another key has changed HOT 13
- Using store.setState(key, value) reruns the reactive context when the state changes. HOT 1
- Future support for version 3.x? HOT 3
- backward compatibility/ final api HOT 6
- How to manage a dynamic subscription based on user input HOT 5
- Routes only work in namespace HOT 10
- Related thread on Meteor Forums - MeteorFlux Flow HOT 2
- Error on startup: Cannot read property 'constructor' of undefined HOT 3
- Mediator cannot be defined in Blaze Components template HOT 21
- Update to use space:[email protected]? HOT 3
- Integrate into Orion HOT 12
- Space UI is hard to debug HOT 8
- Improve APIs and debugging when working in Javascript HOT 2
- Rethinking Space.flux.Application HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui.