backbone.layoutmanager.js
function resolve() {

      // Insert all subViews into the parent at once.
      _.each(root.views, function(views, selector) {
        // Fragments aren't used on arrays of subviews.
        if (_.isArray(views)) {
          root.htmlBatch(root, views, selector);
        }
      });

      // If there is a parent and we weren't attached to it via the previous
      // method (single view), attach.
      if (parent && !manager.insertedViaFragment) {
        if (!root.contains(parent.el, root.el)) {
          // Apply the partial using parent's html() method.
          parent.partial(parent.$el, root.$el, rentManager, manager);
        }
      }

      // Ensure events are always correctly bound after rendering.
      root.delegateEvents();

      // Set this View as successfully rendered.
      root.hasRendered = true;
      manager.renderInProgress = false;

      // Clear triggeredByRAF flag.
      delete manager.triggeredByRAF;

      // Only process the queue if it exists.
      if (manager.queue && manager.queue.length) {
        // Ensure that the next render is only called after all other
        // `done` handlers have completed.  This will prevent `render`
        // callbacks from firing out of order.
        (manager.queue.shift())();
      } else {
        // Once the queue is depleted, remove it, the render process has
        // completed.
        delete manager.queue;
      }

      // Reusable function for triggering the afterRender callback and event.
      function completeRender() {
        var console = window.console;
        var afterRender = root.afterRender;

        if (afterRender) {
          afterRender.call(root, root);
        }

        // Always emit an afterRender event.
        root.trigger("afterRender", root);

        // If there are multiple top level elements and `el: false` is used,
        // display a warning message and a stack trace.
        if (manager.noel && root.$el.length > 1) {
          // Do not display a warning while testing or if warning suppression
          // is enabled.
          if (_.isFunction(console.warn) && !root.suppressWarnings) {
            console.warn("`el: false` with multiple top level elements is " +
              "not supported.");

            // Provide a stack trace if available to aid with debugging.
            if (_.isFunction(console.trace)) {
              console.trace();
            }
          }
        }
      }

      // If the parent is currently rendering, wait until it has completed
      // until calling the nested View's `afterRender`.
      if (rentManager && (rentManager.renderInProgress || rentManager.queue)) {
        // Wait until the parent View has finished rendering, which could be
        // asynchronous, and trigger afterRender on this View once it has
        // completed.
        parent.once("afterRender", completeRender);
      } else {
        // This View and its parent have both rendered.
        completeRender();
      }

      return def.resolveWith(root, [root]);
    }
function resolve() {

      // Insert all subViews into the parent at once.
      _.each(root.views, function(views, selector) {
        // Fragments aren't used on arrays of subviews.
        if (_.isArray(views)) {
          root.htmlBatch(root, views, selector);
        }
      });

      // If there is a parent and we weren't attached to it via the previous
      // method (single view), attach.
      if (parent && !manager.insertedViaFragment) {
        if (!root.contains(parent.el, root.el)) {
          // Apply the partial using parent's html() method.
          parent.partial(parent.$el, root.$el, rentManager, manager);
        }
      }

      // Ensure events are always correctly bound after rendering.
      root.delegateEvents();

      // Set this View as successfully rendered.
      root.hasRendered = true;
      manager.renderInProgress = false;

      // Clear triggeredByRAF flag.
      delete manager.triggeredByRAF;

      // Only process the queue if it exists.
      if (manager.queue && manager.queue.length) {
        // Ensure that the next render is only called after all other
        // `done` handlers have completed.  This will prevent `render`
        // callbacks from firing out of order.
        (manager.queue.shift())();
      } else {
        // Once the queue is depleted, remove it, the render process has
        // completed.
        delete manager.queue;
      }

      // Reusable function for triggering the afterRender callback and event.
      function completeRender() {
        var console = window.console;
        var afterRender = root.afterRender;

        if (afterRender) {
          afterRender.call(root, root);
        }

        // Always emit an afterRender event.
        root.trigger("afterRender", root);

        // If there are multiple top level elements and `el: false` is used,
        // display a warning message and a stack trace.
        if (manager.noel && root.$el.length > 1) {
          // Do not display a warning while testing or if warning suppression
          // is enabled.
          if (_.isFunction(console.warn) && !root.suppressWarnings) {
            console.warn("`el: false` with multiple top level elements is " +
              "not supported.");

            // Provide a stack trace if available to aid with debugging.
            if (_.isFunction(console.trace)) {
              console.trace();
            }
          }
        }
      }

      // If the parent is currently rendering, wait until it has completed
      // until calling the nested View's `afterRender`.
      if (rentManager && (rentManager.renderInProgress || rentManager.queue)) {
        // Wait until the parent View has finished rendering, which could be
        // asynchronous, and trigger afterRender on this View once it has
        // completed.
        parent.once("afterRender", completeRender);
      } else {
        // This View and its parent have both rendered.
        completeRender();
      }

      return def.resolveWith(root, [root]);
    }
function resolve ( ) { // Insert all subViews into the parent at once. _ . each ( root . views , function ( views , selector ) { // Fragments aren't used on arrays of subviews. if ( _ . isArray ( views ) ) { root . htmlBatch ( root , views , selector ) ; } } ) ; // If there is a parent and we weren't attached to it via the previous // method (single view), attach. if ( parent && ! manager . insertedViaFragment ) { if ( ! root . contains ( parent . el , root . el ) ) { // Apply the partial using parent's html() method. parent . partial ( parent . $el , root . $el , rentManager , manager ) ; } } // Ensure events are always correctly bound after rendering. root . delegateEvents ( ) ; // Set this View as successfully rendered. root . hasRendered = true ; manager . renderInProgress = false ; // Clear triggeredByRAF flag. delete manager . triggeredByRAF ; // Only process the queue if it exists. if ( manager . queue && manager . queue . length ) { // Ensure that the next render is only called after all other // `done` handlers have completed.  This will prevent `render` // callbacks from firing out of order. ( manager . queue . shift ( ) ) ( ) ; } else { // Once the queue is depleted, remove it, the render process has // completed. delete manager . queue ; } // Reusable function for triggering the afterRender callback and event. function completeRender ( ) { var console = window . console ; var afterRender = root . afterRender ; if ( afterRender ) { afterRender . call ( root , root ) ; } // Always emit an afterRender event. root . trigger ( "afterRender" , root ) ; // If there are multiple top level elements and `el: false` is used, // display a warning message and a stack trace. if ( manager . noel && root . $el . length > 1 ) { // Do not display a warning while testing or if warning suppression // is enabled. if ( _ . isFunction ( console . warn ) && ! root . suppressWarnings ) { console . warn ( "`el: false` with multiple top level elements is " + "not supported." ) ; // Provide a stack trace if available to aid with debugging. if ( _ . isFunction ( console . trace ) ) { console . trace ( ) ; } } } } // If the parent is currently rendering, wait until it has completed // until calling the nested View's `afterRender`. if ( rentManager && ( rentManager . renderInProgress || rentManager . queue ) ) { // Wait until the parent View has finished rendering, which could be // asynchronous, and trigger afterRender on this View once it has // completed. parent . once ( "afterRender" , completeRender ) ; } else { // This View and its parent have both rendered. completeRender ( ) ; } return def . resolveWith ( root , [ root ] ) ; }
Triggered once the render has succeeded.
Triggered once the render has succeeded .