Skip to content

Commit

Permalink
Merge 5732b71 into 116a8f2
Browse files Browse the repository at this point in the history
  • Loading branch information
Gela committed Oct 24, 2018
2 parents 116a8f2 + 5732b71 commit 97b4fe7
Showing 1 changed file with 4 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
modules.define('jquery', ['next-tick'], function(provide, nextTick, $) {

var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream,
event = $.event.special.pointerclick = {
var event = $.event.special.pointerclick = {
setup : function() {
if(isIOS) {
$(this)
.on('pointerdown', event.onPointerdown)
.on('pointerup', event.onPointerup)
.on('pointerleave pointercancel', event.onPointerleave);
} else {
$(this).on('click', event.handler);
}
$(this).on('click', event.handler);
},

teardown : function() {
if(isIOS) {
$(this)
.off('pointerdown', event.onPointerdown)
.off('pointerup', event.onPointerup)
.off('pointerleave pointercancel', event.onPointerleave);
} else {
$(this).off('click', event.handler);
}
$(this).off('click', event.handler);
},

handler : function(e) {
Expand All @@ -31,32 +16,8 @@ var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream,
$.event.dispatch.apply(this, arguments);
e.type = type;
}
},

onPointerdown : function(e) {
pointerdownEvent = e;
},

onPointerleave : function() {
pointerdownEvent = null;
},

onPointerup : function(e) {
if(!pointerdownEvent) return;

if(!pointerDownUpInProgress) {
nextTick(function() {
pointerDownUpInProgress = false;
pointerdownEvent = null;
});
pointerDownUpInProgress = true;
}

event.handler.apply(this, arguments);
}
},
pointerDownUpInProgress = false,
pointerdownEvent;
};

provide($);

Expand Down

0 comments on commit 97b4fe7

Please sign in to comment.