O'Reilly logo

Getting Started with Backbone Marionette by Arturo Soto, Raymundo Armendariz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the Marionette.RegionManager object

Using regions helps to manage views in a very elegant way. But that may not be enough for some applications, which can have dozens of regions that need to be added and removed during the lifetime of the application. To accomplish this management, we can take advantage of the RegionManager object of Marionette, which will serve as a container for regions.

Having your regions in this container can help us to accomplish almost the same actions, which we could accomplish with a Backbone.Collection object, with the help of underscore methods such as each, map, invoke, contains, and toArray.

The following syntax can help us to declare Marionette.RegionManager:

var regionManager = new Marionette.RegionManager(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required