var isTouch = function() {
// some code here
// return true or false
};
var startEvent = isTouch ? 'touchstart' : 'mousedown',
moveEvent = isTouch ? 'touchmove' : 'mousemove',
endEvent = isTouch ? 'touchend' : 'mouseup';
Element.addEventListener(startEvent, function(){
// do something
});