Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 3ba4a42

Browse files
committed
Touch events: switch from add to setup and add teardown for events
1 parent 0ae9294 commit 3ba4a42

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

js/events/touch.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch"
1414
touchStopEvent = supportTouch ? "touchend" : "mouseup",
1515
touchMoveEvent = supportTouch ? "touchmove" : "mousemove";
1616

17-
// add new event shortcuts
17+
// setup new event shortcuts
1818
$.each( ( "touchstart touchmove touchend " +
1919
"tap taphold " +
2020
"swipe swipeleft swiperight " +
@@ -41,7 +41,7 @@ define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch"
4141
$.event.special.scrollstart = {
4242

4343
enabled: true,
44-
add: function() {
44+
setup: function() {
4545

4646
var thisObject = this,
4747
$this = $( thisObject ),
@@ -70,7 +70,7 @@ define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch"
7070
}, 50 );
7171
});
7272
},
73-
remove: function() {
73+
teardown: function() {git
7474
$( this ).unbind( scrollEvent );
7575
}
7676
};
@@ -79,7 +79,7 @@ define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch"
7979
$.event.special.tap = {
8080
tapholdThreshold: 750,
8181

82-
add: function() {
82+
setup: function() {
8383
var thisObject = this,
8484
$this = $( thisObject );
8585

@@ -123,7 +123,7 @@ define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch"
123123
}, $.event.special.tap.tapholdThreshold );
124124
});
125125
},
126-
remove: function() {
126+
teardown: function() {
127127
$( this ).unbind( "vmousedown" ).unbind( "vclick" ).unbind( "vmouseup" );
128128
$document.unbind( "vmousecancel" );
129129
}
@@ -168,7 +168,7 @@ define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch"
168168
}
169169
},
170170

171-
add: function() {
171+
setup: function() {
172172
var thisObject = this,
173173
$this = $( thisObject );
174174

@@ -201,7 +201,7 @@ define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch"
201201
});
202202
},
203203

204-
remove: function() {
204+
teardown: function() {
205205
$( this ).unbind( touchStartEvent ).unbind( touchMoveEvent ).unbind( touchStopEvent );
206206
}
207207
};
@@ -215,6 +215,9 @@ define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch"
215215
$.event.special[ event ] = {
216216
setup: function() {
217217
$( this ).bind( sourceEvent, $.noop );
218+
},
219+
teardown: function() {
220+
$( this ).unbind( sourceEvent );
218221
}
219222
};
220223
});

0 commit comments

Comments
 (0)