aurajs / aura

A scalable, event-driven JavaScript architecture for developing component-based applications.
MIT License
2.94k stars 255 forks source link

Pubsub between parent and child component #326

Open yapcheahshen opened 10 years ago

yapcheahshen commented 10 years ago

Assume that: aura_components/mainview_widget // a tabs interface aura_components/tab_widget aura_components/A_widget aura_components/B_imp1_widget aura_components/B_imp2_widget

mainview_widget has children A_widget and multiple instances of tab_widget tab_widget has children A and B ( either B_imp1_widget or B_imp2_widget)

My questions: 1) How could A_widget get it's parent view object without knowing the component name? is there a cleaner way than "use jQuery parent() recursively and look for div with data-aura-widget attribute, get the backbone view object from the doc node " 2) How could tab_widget notify only child components via emit/on without knowing component name? 3) How could tab_widget notify a certain type of children regardless of the implementation name, e.g, notifying "B" instead of B_imp1, B_imp2 .

josephspens commented 9 years ago

What kind of interactions are these components making between each other that require them to know about each other?

yapcheahshen commented 9 years ago

Thanks for the attention but now I'm using React.js

2015-07-26 8:24 GMT+08:00 Joseph Spens notifications@github.com:

What kind of interactions are these components making between each other that require them to know about each other?

— Reply to this email directly or view it on GitHub https://github.com/aurajs/aura/issues/326#issuecomment-124920389.