marionettejs/backbone.marionette — pull request #1018 by jasonLaster (2014-03-17 02:48:26+00:00)
Title: Add before:show events

Earlier today, jarrodpayne raised an issue in #marionette and stackOverflow [question](
https://stackoverflow.com/questions/22442198/can-i-render-views-to-layout-regions-before-showing-that-layout-in-a-parent-regi) about rendering a nested layout before its added to the DOM.

I think a "before:show" event in `region.show` would be an elegant way to solve the problem.

```js
var LayoutView = Marionette.Layout.extend({
template: "#layout-template",
regions: {
one: ".one",
two: ".two",
three: ".three"
},

onBeforeShow: function() {
console.log('before show');
this.one.show(new SubView());
var col = new Backbone.Collection([{ p: 1}, {p: 2}, {p: 3}]);
this.two.show(new CollectionView({
collection: col
}));
this.three.show(new SubView());
}
});
```

This way, `layout.el` would be fully rendered before `region.$el` is reset.