Skip to content

Commit d1ec266

Browse files
committed
为包装后的events提供原生的target
1 parent 1441294 commit d1ec266

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

asset/toucher.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77

88

99
(function(global,doc,factoryFn){
10-
var factory = factoryFn();
10+
//初始化toucher主方法
11+
var factory = factoryFn(global,doc);
12+
1113
//提供window.util.toucher()接口
1214
global.util = global.util || {};
1315
global.util.toucher = global.util.toucher || factory;
16+
1417
//提供CommonJS规范的接口
1518
global.define && define(function(require,exports,module){
1619
//对外接口
1720
return factory;
1821
});
19-
})(this,document,function(){
22+
})(this,document,function(window,document){
2023
/**
2124
* 判断是否拥有某个class
2225
*/
@@ -138,6 +141,7 @@
138141

139142
var newE = {
140143
'type' : name,
144+
'target' : e.target,
141145
'pageX' : touch.clientX || 0,
142146
'pageY' : touch.clientY || 0
143147
};
@@ -174,14 +178,19 @@
174178

175179
//轻击开始时间
176180
var touchStartTime = 0;
181+
177182
//记录上一次点击时间
178183
var lastTouchTime = 0;
184+
179185
//记录初始轻击的位置
180186
var x1,y1,x2,y2;
187+
181188
//轻击事件的延时器
182189
var touchDelay;
190+
183191
//测试长按事件的延时器
184192
var longTap;
193+
185194
//记录当前事件是否已为等待结束的状态
186195
var isActive = false;
187196
//记录有坐标信息的事件

0 commit comments

Comments
 (0)