backbone.layoutmanager.js
function(callback, deferred) {
    var root = this;
    var manager = root.__manager__;
    var rentManager = manager.parent && manager.parent.__manager__;

    // Allow RAF processing to be shut off using `useRAF`:false.
    if (this.useRAF === false) {
      if (manager.queue) {
        aPush.call(manager.queue, callback);
      } else {
        manager.queue = [];
        callback();
      }
      return;
    }

    // Keep track of all deferreds so we can resolve them.
    manager.deferreds = manager.deferreds || [];
    manager.deferreds.push(deferred);

    // Schedule resolving all deferreds that are waiting.
    deferred.done(resolveDeferreds);

    // Cancel any other renders on this view that are queued to execute.
    this._cancelQueuedRAFRender();

    // Trigger immediately if the parent was triggered by RAF.
    // The flag propagates downward so this view's children are also
    // rendered immediately.
    if (rentManager && rentManager.triggeredByRAF) {
      return finish();
    }

    // Register this request with requestAnimationFrame.
    manager.rafID = root.requestAnimationFrame(finish);

    function finish() {
      // Remove this ID as it is no longer valid.
      manager.rafID = null;

      // Set flag (will propagate to children) so they render
      // without waiting for RAF.
      manager.triggeredByRAF = true;

      // Call original cb.
      callback();
    }

    // Resolve all deferreds that were cancelled previously, if any.
    // This allows the user to bind callbacks to any render callback,
    // even if it was cancelled above.
    function resolveDeferreds() {
      for (var i = 0; i < manager.deferreds.length; i++){
        manager.deferreds[i].resolveWith(root, [root]);
      }
      manager.deferreds = [];
    }
  }
function(callback, deferred) {
    var root = this;
    var manager = root.__manager__;
    var rentManager = manager.parent && manager.parent.__manager__;

    // Allow RAF processing to be shut off using `useRAF`:false.
    if (this.useRAF === false) {
      if (manager.queue) {
        aPush.call(manager.queue, callback);
      } else {
        manager.queue = [];
        callback();
      }
      return;
    }

    // Keep track of all deferreds so we can resolve them.
    manager.deferreds = manager.deferreds || [];
    manager.deferreds.push(deferred);

    // Schedule resolving all deferreds that are waiting.
    deferred.done(resolveDeferreds);

    // Cancel any other renders on this view that are queued to execute.
    this._cancelQueuedRAFRender();

    // Trigger immediately if the parent was triggered by RAF.
    // The flag propagates downward so this view's children are also
    // rendered immediately.
    if (rentManager && rentManager.triggeredByRAF) {
      return finish();
    }

    // Register this request with requestAnimationFrame.
    manager.rafID = root.requestAnimationFrame(finish);

    function finish() {
      // Remove this ID as it is no longer valid.
      manager.rafID = null;

      // Set flag (will propagate to children) so they render
      // without waiting for RAF.
      manager.triggeredByRAF = true;

      // Call original cb.
      callback();
    }

    // Resolve all deferreds that were cancelled previously, if any.
    // This allows the user to bind callbacks to any render callback,
    // even if it was cancelled above.
    function resolveDeferreds() {
      for (var i = 0; i < manager.deferreds.length; i++){
        manager.deferreds[i].resolveWith(root, [root]);
      }
      manager.deferreds = [];
    }
  }
function ( callback , deferred ) { var root = this ; var manager = root . __manager__ ; var rentManager = manager . parent && manager . parent . __manager__ ; // Allow RAF processing to be shut off using `useRAF`:false. if ( this . useRAF === false ) { if ( manager . queue ) { aPush . call ( manager . queue , callback ) ; } else { manager . queue = [ ] ; callback ( ) ; } return ; } // Keep track of all deferreds so we can resolve them. manager . deferreds = manager . deferreds || [ ] ; manager . deferreds . push ( deferred ) ; // Schedule resolving all deferreds that are waiting. deferred . done ( resolveDeferreds ) ; // Cancel any other renders on this view that are queued to execute. this . _cancelQueuedRAFRender ( ) ; // Trigger immediately if the parent was triggered by RAF. // The flag propagates downward so this view's children are also // rendered immediately. if ( rentManager && rentManager . triggeredByRAF ) { return finish ( ) ; } // Register this request with requestAnimationFrame. manager . rafID = root . requestAnimationFrame ( finish ) ; function finish ( ) { // Remove this ID as it is no longer valid. manager . rafID = null ; // Set flag (will propagate to children) so they render // without waiting for RAF. manager . triggeredByRAF = true ; // Call original cb. callback ( ) ; } // Resolve all deferreds that were cancelled previously, if any. // This allows the user to bind callbacks to any render callback, // even if it was cancelled above. function resolveDeferreds ( ) { for ( var i = 0 ; i < manager . deferreds . length ; i ++ ) { manager . deferreds [ i ] . resolveWith ( root , [ root ] ) ; } manager . deferreds = [ ] ; } }
Register a view render with RAF.
Register a view render with RAF .