## Helper functions. 
### getPreviousStage

Returns the previous step accordingly with widget's settings

@param {BackButton} that The current instance

@return {GameStage|Boolean} The previous step or FALSE if none is found
171648
function getPreviousStep(that) {
        var curStage,  prevStage;
        curStage = node.game.getCurrentGameStage();
        if (curStage.stage === 0) return;
        prevStage = node.game.getPreviousStep();
        if (prevStage.stage === 0) return;
        if ((curStage.stage > prevStage.stage) && !that.acrossStages) {
            return false;
        }
        if ((curStage.round > prevStage.round) && !that.acrossRounds) {
            return false;
        }
        return prevStage;
    }
660877
private boolean isNewStep(RouteProgress routeProgress) {
    boolean isNewStep = currentStep == null || !currentStep.equals(routeProgress.currentLegProgress().currentStep());
    currentStep = routeProgress.currentLegProgress().currentStep();
    resetAlertLevels(isNewStep);
    return isNewStep;
  }
693865
private boolean newStep(RouteProgress routeProgress) {
    boolean newStep = currentStep == null || !currentStep.equals(routeProgress.currentLegProgress().currentStep());
    currentStep = routeProgress.currentLegProgress().currentStep();
    return newStep;
  }
1201941
public List<String> getCurrentStages(Long processId, boolean reload) {
        if (reload) {
            reload(processId);
        }

        List<String> stages = currentStages.get(processId);
        if (stages == null) {
            stages = new ArrayList<String>();
        }
        return stages;
    }
371603
function(current) {
                    if (typeof current.steps === 'object' && typeof current.steps.map === 'function' && current.steps.length > 0) {
                      return current.steps;
                    }
                    var steps = null;
                    if (typeof current.render === 'function') {
                      try {
                        steps = findScreenerStepsInRender(current.render(function(fn) {
                          return fn;
                        }));
                      } catch (ex) {
                        steps = null;
                      }
                    }
                    if (typeof current.components === 'object' && typeof current.components.story === 'object' && typeof current.components.story.render === 'function') {
                      try {
                        steps = findScreenerStepsInRender(current.components.story.render(function(fn) {
                          return fn;
                        }, {}));
                      } catch (ex) {
                        steps = null;
                      }
                    }
                    return steps;
                  }
1100065
function (id, buttonState) {
    var evtName;
    var previousButtonState = this.buttonStates[id];

    // Not changed.
    if (buttonState.pressed === previousButtonState.pressed) { return false; }

    evtName = buttonState.pressed ? EVENTS.BUTTONDOWN : EVENTS.BUTTONUP;
    this.el.emit(evtName, this.buttonEventDetails[id], false);
    previousButtonState.pressed = buttonState.pressed;
    return true;
  }
298110
function pro(){
            var src = this.src;
           
            //Remove events cause audio trigger this event more than once(depends on browser)
            if (this.removeEventListener) {  
                this.removeEventListener('canplaythrough', pro, false);     
            }
           
            ++j;
            //if progress callback, give information of assets loaded, total and percent
            if (onprogress) 
                onprogress({
                    loaded: j, 
                    total: total, 
                    percent: (j / total * 100),
                    src:src
                });
				
            if(j === total && oncomplete) oncomplete();
        }
1039929
function prev(array, item) {
  if (array && array.length && item) {
    const idx = array.indexOf(item);
    return idx === -1 ? null : array[idx - 1];
  }
  return null;
}
955251
function() {
            var prev = steps.indexOf( activeStep ) - 1;
            prev = prev >= 0 ? steps[ prev ] : steps[ steps.length - 1 ];
            impressHI.trigger('impress:prev');

            return goto( prev );
        }
284874
function() {
            var next = steps.indexOf( activeStep ) + 1;
            next = next < steps.length ? steps[ next ] : steps[ 0 ];
            impressHI.trigger('impress:next');

            return goto( next );
        }
370602
def goto_prev_component
      if @current_component != nil 
        leave_current_component
        if on_first_component?
          @_entered = false
          return :UNHANDLED
        end
        @current_index = @components.index(@current_component)
        index = @current_index -= 1
        index.downto(0) do |i|
          f = @components[i]
          if f.focusable
            @current_index = i
            @current_component = f
            return set_form_row
          end
        end
      end
      return :UNHANDLED
    end
302987
function topLevelNodeBefore(node, top) {
    while (!node.previousSibling && node.parentNode != top)
      node = node.parentNode;
    return topLevelNodeAt(node.previousSibling, top);
  }
1140066
public boolean previousPath() {
		// pre-decrement
		if (m_nextPathIndex == 0)
			return false;

		m_nextPathIndex--;
		m_currentSegmentIndex = -1;
		m_nextSegmentIndex = 0;
		m_segmentCount = _getSegmentCount(m_nextPathIndex);
		m_currentPathIndex = m_nextPathIndex;
		m_pathBegin = m_parent.getPathStart(m_currentPathIndex);
		resetToLastSegment();
		return true;
	}
1174779
function getGameBeforeLastMove(game) {
    // $Fix I do NOT know if it is the best way to make game immutable.
    game = Object.assign({}, game);
    let lastMove = game.moves.pop();
    if (lastMove)
        game = getGameAfterMove(game, getBackMove(lastMove), true);
    if (Game.getPlayerTurn(game).isAi) {
        lastMove = game.moves.pop();
        if (lastMove) {
            game = getGameAfterMove(game, getBackMove(lastMove), true);
        }
    }
    return game;
}
297778
function fallback(fn) {
  const curr = Date.now();
  const ms = Math.max(0, 16 - (curr - prev));
  const id = setTimeout(fn, ms);
  prev = curr + ms;
  return id;
}
751455
function run()
    {
        if ( $this->HTTP->hasPostVariable( 'PreviousButton' ) )
        {
            return $this->previousStep();
        }

        switch( $this->metaData( 'current_stage' ) )
        {
            case eZWizardBase::STAGE_PRE:
            {
                $this->preCheck();
                $this->nextStep();
                if ( $this->skip() )
                {
                    return $this->nextStep();
                }
                return $this->process();
            } break;

            case eZWizardBase::STAGE_POST:
            {
                if ( $this->postCheck() )
                {
                    return $this->nextStep();
                }
                else
                {
                    return $this->process();
                }
            } break;
        }
    }
564179
function beforeTransition(){
          if (typeof scope.joyride.config.steps[scope.joyride.current].afterStep === "function") {
            scope.joyride.config.steps[scope.joyride.current].afterStep(afterTransition);
          }

          else{
            afterTransition();
          }
        }