code: function updateStateAfterScroll(item, sentinel) {
          var carousel   = this,
              page       = carousel.get("currentPage"),
              newPage,
              numPerPage = carousel.get("numVisible");
  
          newPage = parseInt(carousel._firstItem / numPerPage, 10);
          if (newPage != page) {
              carousel.setAttributeConfig("currentPage", { value: newPage });
              carousel.fireEvent(pageChangeEvent, newPage);
          }
  
          if (carousel.get("selectOnScroll")) {
              if (carousel.get("selectedItem") != carousel._selectedItem) {
                  carousel.set("selectedItem", carousel._selectedItem);
              }
          }
  
          clearTimeout(carousel._autoPlayTimer);
          delete carousel._autoPlayTimer;
          if (carousel.isAutoPlayOn()) {
              carousel.startAutoPlay();
          }
  
          carousel.fireEvent(afterScrollEvent,
                             { first: carousel._firstItem,
                               last: sentinel },
                             carousel);
      }
docs: Update the state variables after scrolling the Carousel view port.
  
  @method updateStateAfterScroll
  @param {Integer} item The index to which the Carousel has scrolled to.
  @param {Integer} sentinel The last element in the view port.
  @private