code: function() {
        /*
         * For the sake of explanations below, we're going to pretend we are scrolling
         * vertically: Items are laid out with primarySize being height,
         * secondarySize being width.
         */
        var primaryPos = 0;
        var secondaryPos = 0;
        var secondaryScrollSize = this.secondaryScrollSize();
        var previousItem;
  
        this.dataSource.beforeSiblings && this.dataSource.beforeSiblings.forEach(calculateSize, this);
        var beforeSize = primaryPos + (previousItem ? previousItem.primarySize : 0);
  
        primaryPos = secondaryPos = 0;
        previousItem = null;
  
        var dimensions = this.dataSource.dimensions.map(calculateSize, this);
        var totalSize = primaryPos + (previousItem ? previousItem.primarySize : 0);
  
        return {
          beforeSize: beforeSize,
          totalSize: totalSize,
          dimensions: dimensions
        };
  
        function calculateSize(dim) {
  
          //Each dimension is an object {width: Number, height: Number} provided by
          //the dataSource
          var rect = {
            //Get the height out of the dimension object
            primarySize: this.primaryDimension(dim),
            //Max out the item's width to the width of the scrollview
            secondarySize: Math.min(this.secondaryDimension(dim), secondaryScrollSize)
          };
  
          //If this isn't the first item
          if (previousItem) {
            //Move the item's x position over by the width of the previous item
            secondaryPos += previousItem.secondarySize;
            //If the y position is the same as the previous item and
            //the x position is bigger than the scroller's width
            if (previousItem.primaryPos === primaryPos &&
                secondaryPos + rect.secondarySize > secondaryScrollSize) {
              //Then go to the next row, with x position 0
              secondaryPos = 0;
              primaryPos += previousItem.primarySize;
            }
          }
  
          rect.primaryPos = primaryPos;
          rect.secondaryPos = secondaryPos;
  
          previousItem = rect;
          return rect;
        }
      }
docs: /*
  Pre-calculate the position of all items in the data list.
  Do this using the provided width and height (primarySize and secondarySize)
  provided by the dataSource.