简体   繁体   中英

Questions about views in famo.us

Im just starting with famo.us and javascript. And i really need some help with the views in famo.us.

Could you please tell me how you close a View ? How does your code look like ?

Is it true that if I have a view in a view in a view, I have to pass the events from view to view ?

Im sorry for my english.

Views in Famo.us are abstract classes. Surfaces are the only actual elements. Views are just there to make things easier and more composable.

Views themselves cannot be closed. You need to use a RenderController if you want to hide something and show something else. There are some hacks to hide something completely, but I would recommend you not go down that line.

If you have a view inside a view, YES you need to pass events from view to view. Unlike Backbone.js no events are EVER bubbled automatically. So you can set up .pipe to connect up events in all cases.

It's also important to note that the design pattern in famo.us is to have two eventEmitters per view. One for incoming events and one for outgoing events. You don't have to follow this design pattern yourself, but it is important to understand it for a deeper understanding of the framework.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM