Search code examples
javascriptmarionette

regionType poperty in Marionette


MyApp.addRegions({
  someRegion: {
    selector: "#foo",
    regionType: MyCustomRegion
  })

what's regionType in Marionette and how use it ?


Solution

  • By default the regionType is set to Marionette.Region.

    But if you want some special functionality from your Region you could create a custom Region.

    var MyCustomRegion = Marionette.Region.extend({
        initialize: function(){
            console.log("I'm special!");
        }
    });
    

    You could then use MyCustomRegion like in your example:

    MyApp.addRegions({
        someRegion: {
            selector: "#foo",
            regionType: MyCustomRegion
        })