extensions/amp-carousel/0.2/amp-carousel.js
/**
   * Updates the current index, triggering actions and analytics events.
   * @param {number} index
   * @param {!ActionSource} actionSource
   */
Updates the current index, triggering actions and analytics events.
@param {number} index
@param {!ActionSource} actionSource
Updates the current index triggering actions and analytics events . @param { number } index @param { !ActionSource } actionSource
updateCurrentIndex_(index, actionSource) {
    const prevIndex = this.currentIndex_;
    this.currentIndex_ = index;
    if (prevIndex == null) {
      return;
    }
    const data = dict({'index': index});
    const name = 'slideChange';
    const isHighTrust = this.isHighTrustActionSource_(actionSource);
    const trust = isHighTrust ? ActionTrust_Enum.HIGH : ActionTrust_Enum.LOW;
    const dataWithActionTrust = dict({'index': index, 'actionTrust': trust});
    const action = createCustomEvent(this.win, `slidescroll.${name}`, data);
    this.action_.trigger(this.element, name, action, trust);
    dispatchCustomEvent(this.element, name, dataWithActionTrust);
    this.triggerAnalyticsEvent_(prevIndex, index);
  }
updateCurrentIndex_ ( index , actionSource ) { const prevIndex = this . currentIndex_ ; this . currentIndex_ = index ; if ( prevIndex == null ) { return ; } const data = dict ( { 'index' : index } ) ; const name = 'slideChange' ; const isHighTrust = this . isHighTrustActionSource_ ( actionSource ) ; const trust = isHighTrust ? ActionTrust_Enum . HIGH : ActionTrust_Enum . LOW ; const dataWithActionTrust = dict ( { 'index' : index , 'actionTrust' : trust } ) ; const action = createCustomEvent ( this . win , ` ${ name } ` , data ) ; this . action_ . trigger ( this . element , name , action , trust ) ; dispatchCustomEvent ( this . element , name , dataWithActionTrust ) ; this . triggerAnalyticsEvent_ ( prevIndex , index ) ; }
Updates the current index, triggering actions and analytics events.
Updates the current index triggering actions and analytics events .
// Ignore the first indexChange, we do not want to trigger any events.