We started by creating common view types that are common for almost every project. Those views are simple in principle but powerful; we can effectively manage nested views without worrying about insufficient memory.
We learned that, by encapsulating common patterns in the render()
method, we can create useful view types; in this chapter, we have seen four of them but if you are curious I encourage you to take a look at the Marionette framework, which works on top of Backbone.
Marionette includes all the views exposed here: ItemView
, CollectionView
, LayoutView
, Regions. and other useful view types. Marionette objects behave very similarly to what we see here, so that you can easily interchange Marionette objects with those described in this chapter.
Plugins should be called only after the view is on the DOM, because most plugins are DOM-dependent. When rendering plugins, remember to do it in the view not outside it; the onShow()
callback strategy ensures that the view is available...