plugins/touchswipe.js
function getNextPhase(currentPhase) {
			
			var nextPhase = currentPhase;
			
			// Ensure we have valid swipe (under time and over distance  and check if we are out of bound...)
			var validTime = validateSwipeTime();
			var validDistance = validateSwipeDistance();
			var didCancel = didSwipeBackToCancel();
						
			//If we have exceeded our time, then cancel	
			if(!validTime || didCancel) {
				nextPhase = PHASE_CANCEL;
			}
			//Else if we are moving, and have reached distance then end
			else if (validDistance && currentPhase == PHASE_MOVE && (!options.triggerOnTouchEnd || options.triggerOnTouchLeave) ) {
				nextPhase = PHASE_END;
			} 
			//Else if we have ended by leaving and didn't reach distance, then cancel
			else if (!validDistance && currentPhase==PHASE_END && options.triggerOnTouchLeave) {
				nextPhase = PHASE_CANCEL;
			}
			
			return nextPhase;
		}
function getNextPhase(currentPhase) {
			
			var nextPhase = currentPhase;
			
			// Ensure we have valid swipe (under time and over distance  and check if we are out of bound...)
			var validTime = validateSwipeTime();
			var validDistance = validateSwipeDistance();
			var didCancel = didSwipeBackToCancel();
						
			//If we have exceeded our time, then cancel	
			if(!validTime || didCancel) {
				nextPhase = PHASE_CANCEL;
			}
			//Else if we are moving, and have reached distance then end
			else if (validDistance && currentPhase == PHASE_MOVE && (!options.triggerOnTouchEnd || options.triggerOnTouchLeave) ) {
				nextPhase = PHASE_END;
			} 
			//Else if we have ended by leaving and didn't reach distance, then cancel
			else if (!validDistance && currentPhase==PHASE_END && options.triggerOnTouchLeave) {
				nextPhase = PHASE_CANCEL;
			}
			
			return nextPhase;
		}
function getNextPhase ( currentPhase ) { var nextPhase = currentPhase ; // Ensure we have valid swipe (under time and over distance  and check if we are out of bound...) var validTime = validateSwipeTime ( ) ; var validDistance = validateSwipeDistance ( ) ; var didCancel = didSwipeBackToCancel ( ) ; //If we have exceeded our time, then cancel	 if ( ! validTime || didCancel ) { nextPhase = PHASE_CANCEL ; } //Else if we are moving, and have reached distance then end else if ( validDistance && currentPhase == PHASE_MOVE && ( ! options . triggerOnTouchEnd || options . triggerOnTouchLeave ) ) { nextPhase = PHASE_END ; } //Else if we have ended by leaving and didn't reach distance, then cancel else if ( ! validDistance && currentPhase == PHASE_END && options . triggerOnTouchLeave ) { nextPhase = PHASE_CANCEL ; } return nextPhase ; }
Checks if the time and distance thresholds have been met, and if so then the appropriate handlers are fired.
Checks if the time and distance thresholds have been met and if so then the appropriate handlers are fired .