code: function handleLayout(obj, stats, depth) {
        var layoutName = obj.layout.basename;
        debug('applied layout (#%d) "%s", to view "%s"', depth, layoutName, view.path);
  
        view.currentLayout = obj.layout;
        view.define('layoutStack', stats.history);
        app.handleOnce('onLayout', view);
        delete view.currentLayout;
      }
docs: Handle each layout before it's applied to a view