4 ms·
The pub/sub thing is a great pattern and it doesn't make you write more code. In your example, would all the data the modules need to generate their templates b
by swah 14y ago
The pub/sub thing is a great pattern and it doesn't make you write more code. In your example, would all the data the modules need to generate their templates be included with the event "loggedin"?
- geuis 14y agoIt depends, but generally yes as I do it. I've found that in most cases the size of data associated with an event is quite small and easily passed around as objects, arrays, or whatever is needed. So if a particular module for a sidebar, a headbar, or mainview all need to update based on an event they subscribe to, each module constructs it's own templates based in the data passed with the event.