@whitesev/domutils 1.7.5 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/index.amd.js +333 -223
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +333 -223
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +333 -223
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +333 -223
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +333 -223
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +333 -223
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/ElementEvent.d.ts +134 -106
- package/dist/types/src/types/DOMUtilsEvent.d.ts +15 -2
- package/package.json +10 -10
- package/src/ElementEvent.ts +298 -135
- package/src/types/DOMUtilsEvent.d.ts +15 -2
package/dist/index.system.js
CHANGED
|
@@ -118,47 +118,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
118
118
|
const cache = createCache(LAST_NUMBER_WEAK_MAP);
|
|
119
119
|
const generateUniqueNumber = createGenerateUniqueNumber(cache, LAST_NUMBER_WEAK_MAP);
|
|
120
120
|
|
|
121
|
-
const
|
|
122
|
-
return typeof sender.start === 'function';
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const PORT_MAP = new WeakMap();
|
|
126
|
-
|
|
127
|
-
const extendBrokerImplementation = (partialBrokerImplementation) => ({
|
|
128
|
-
...partialBrokerImplementation,
|
|
129
|
-
connect: ({ call }) => {
|
|
130
|
-
return async () => {
|
|
131
|
-
const { port1, port2 } = new MessageChannel();
|
|
132
|
-
const portId = await call('connect', { port: port1 }, [port1]);
|
|
133
|
-
PORT_MAP.set(port2, portId);
|
|
134
|
-
return port2;
|
|
135
|
-
};
|
|
136
|
-
},
|
|
137
|
-
disconnect: ({ call }) => {
|
|
138
|
-
return async (port) => {
|
|
139
|
-
const portId = PORT_MAP.get(port);
|
|
140
|
-
if (portId === undefined) {
|
|
141
|
-
throw new Error('The given port is not connected.');
|
|
142
|
-
}
|
|
143
|
-
await call('disconnect', { portId });
|
|
144
|
-
};
|
|
145
|
-
},
|
|
146
|
-
isSupported: ({ call }) => {
|
|
147
|
-
return () => call('isSupported');
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
const ONGOING_REQUESTS = new WeakMap();
|
|
152
|
-
const createOrGetOngoingRequests = (sender) => {
|
|
153
|
-
if (ONGOING_REQUESTS.has(sender)) {
|
|
154
|
-
// @todo TypeScript needs to be convinced that has() works as expected.
|
|
155
|
-
return ONGOING_REQUESTS.get(sender);
|
|
156
|
-
}
|
|
157
|
-
const ongoingRequests = new Map();
|
|
158
|
-
ONGOING_REQUESTS.set(sender, ongoingRequests);
|
|
159
|
-
return ongoingRequests;
|
|
160
|
-
};
|
|
161
|
-
const createBroker = (brokerImplementation) => {
|
|
121
|
+
const createBrokerFactory = (createOrGetOngoingRequests, extendBrokerImplementation, generateUniqueNumber, isMessagePort) => (brokerImplementation) => {
|
|
162
122
|
const fullBrokerImplementation = extendBrokerImplementation(brokerImplementation);
|
|
163
123
|
return (sender) => {
|
|
164
124
|
const ongoingRequests = createOrGetOngoingRequests(sender);
|
|
@@ -201,81 +161,115 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
201
161
|
};
|
|
202
162
|
};
|
|
203
163
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
164
|
+
const createCreateOrGetOngoingRequests = (ongoingRequestsMap) => (sender) => {
|
|
165
|
+
if (ongoingRequestsMap.has(sender)) {
|
|
166
|
+
// @todo TypeScript needs to be convinced that has() works as expected.
|
|
167
|
+
return ongoingRequestsMap.get(sender);
|
|
168
|
+
}
|
|
169
|
+
const ongoingRequests = new Map();
|
|
170
|
+
ongoingRequestsMap.set(sender, ongoingRequests);
|
|
171
|
+
return ongoingRequests;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const createExtendBrokerImplementation = (portMap) => (partialBrokerImplementation) => ({
|
|
175
|
+
...partialBrokerImplementation,
|
|
176
|
+
connect: ({ call }) => {
|
|
177
|
+
return async () => {
|
|
178
|
+
const { port1, port2 } = new MessageChannel();
|
|
179
|
+
const portId = await call('connect', { port: port1 }, [port1]);
|
|
180
|
+
portMap.set(port2, portId);
|
|
181
|
+
return port2;
|
|
216
182
|
};
|
|
217
183
|
},
|
|
218
|
-
|
|
219
|
-
return (
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
scheduledTimeoutsState.delete(timerId);
|
|
224
|
-
});
|
|
184
|
+
disconnect: ({ call }) => {
|
|
185
|
+
return async (port) => {
|
|
186
|
+
const portId = portMap.get(port);
|
|
187
|
+
if (portId === undefined) {
|
|
188
|
+
throw new Error('The given port is not connected.');
|
|
225
189
|
}
|
|
190
|
+
await call('disconnect', { portId });
|
|
226
191
|
};
|
|
227
192
|
},
|
|
228
|
-
|
|
229
|
-
return (
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
// Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func().
|
|
246
|
-
if (scheduledIntervalsState.get(timerId) === symbol) {
|
|
247
|
-
schedule();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
schedule();
|
|
252
|
-
return timerId;
|
|
253
|
-
};
|
|
254
|
-
},
|
|
255
|
-
setTimeout: ({ call }) => {
|
|
256
|
-
return (func, delay = 0, ...args) => {
|
|
257
|
-
const symbol = Symbol();
|
|
258
|
-
const timerId = generateUniqueNumber(scheduledTimeoutsState);
|
|
259
|
-
scheduledTimeoutsState.set(timerId, symbol);
|
|
260
|
-
call('set', {
|
|
261
|
-
delay,
|
|
262
|
-
now: performance.timeOrigin + performance.now(),
|
|
263
|
-
timerId,
|
|
264
|
-
timerType: 'timeout'
|
|
265
|
-
}).then(() => {
|
|
266
|
-
const state = scheduledTimeoutsState.get(timerId);
|
|
267
|
-
if (state === undefined) {
|
|
268
|
-
throw new Error('The timer is in an undefined state.');
|
|
269
|
-
}
|
|
270
|
-
if (state === symbol) {
|
|
271
|
-
// A timeout can be savely deleted because it is only called once.
|
|
272
|
-
scheduledTimeoutsState.delete(timerId);
|
|
273
|
-
func(...args);
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
return timerId;
|
|
277
|
-
};
|
|
193
|
+
isSupported: ({ call }) => {
|
|
194
|
+
return () => call('isSupported');
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
const isMessagePort = (sender) => {
|
|
199
|
+
return typeof sender.start === 'function';
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const createBroker = createBrokerFactory(createCreateOrGetOngoingRequests(new WeakMap()), createExtendBrokerImplementation(new WeakMap()), generateUniqueNumber, isMessagePort);
|
|
203
|
+
|
|
204
|
+
const createClearIntervalFactory = (scheduledIntervalsState) => (clear) => (timerId) => {
|
|
205
|
+
if (typeof scheduledIntervalsState.get(timerId) === 'symbol') {
|
|
206
|
+
scheduledIntervalsState.set(timerId, null);
|
|
207
|
+
clear(timerId).then(() => {
|
|
208
|
+
scheduledIntervalsState.delete(timerId);
|
|
209
|
+
});
|
|
278
210
|
}
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const createClearTimeoutFactory = (scheduledTimeoutsState) => (clear) => (timerId) => {
|
|
214
|
+
if (typeof scheduledTimeoutsState.get(timerId) === 'symbol') {
|
|
215
|
+
scheduledTimeoutsState.set(timerId, null);
|
|
216
|
+
clear(timerId).then(() => {
|
|
217
|
+
scheduledTimeoutsState.delete(timerId);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const createSetIntervalFactory = (generateUniqueNumber, scheduledIntervalsState) => (set) => (func, delay = 0, ...args) => {
|
|
223
|
+
const symbol = Symbol();
|
|
224
|
+
const timerId = generateUniqueNumber(scheduledIntervalsState);
|
|
225
|
+
scheduledIntervalsState.set(timerId, symbol);
|
|
226
|
+
const schedule = () => set(delay, timerId).then(() => {
|
|
227
|
+
const state = scheduledIntervalsState.get(timerId);
|
|
228
|
+
if (state === undefined) {
|
|
229
|
+
throw new Error('The timer is in an undefined state.');
|
|
230
|
+
}
|
|
231
|
+
if (state === symbol) {
|
|
232
|
+
func(...args);
|
|
233
|
+
// Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func().
|
|
234
|
+
if (scheduledIntervalsState.get(timerId) === symbol) {
|
|
235
|
+
schedule();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
schedule();
|
|
240
|
+
return timerId;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const createSetTimeoutFactory = (generateUniqueNumber, scheduledTimeoutsState) => (set) => (func, delay = 0, ...args) => {
|
|
244
|
+
const symbol = Symbol();
|
|
245
|
+
const timerId = generateUniqueNumber(scheduledTimeoutsState);
|
|
246
|
+
scheduledTimeoutsState.set(timerId, symbol);
|
|
247
|
+
set(delay, timerId).then(() => {
|
|
248
|
+
const state = scheduledTimeoutsState.get(timerId);
|
|
249
|
+
if (state === undefined) {
|
|
250
|
+
throw new Error('The timer is in an undefined state.');
|
|
251
|
+
}
|
|
252
|
+
if (state === symbol) {
|
|
253
|
+
// A timeout can be savely deleted because it is only called once.
|
|
254
|
+
scheduledTimeoutsState.delete(timerId);
|
|
255
|
+
func(...args);
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
return timerId;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
// Prefilling the Maps with a function indexed by zero is necessary to be compliant with the specification.
|
|
262
|
+
const scheduledIntervalsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
263
|
+
const scheduledTimeoutsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
264
|
+
const createClearInterval = createClearIntervalFactory(scheduledIntervalsState);
|
|
265
|
+
const createClearTimeout = createClearTimeoutFactory(scheduledTimeoutsState);
|
|
266
|
+
const createSetInterval = createSetIntervalFactory(generateUniqueNumber, scheduledIntervalsState);
|
|
267
|
+
const createSetTimeout = createSetTimeoutFactory(generateUniqueNumber, scheduledTimeoutsState);
|
|
268
|
+
const wrap = createBroker({
|
|
269
|
+
clearInterval: ({ call }) => createClearInterval((timerId) => call('clear', { timerId, timerType: 'interval' })),
|
|
270
|
+
clearTimeout: ({ call }) => createClearTimeout((timerId) => call('clear', { timerId, timerType: 'timeout' })),
|
|
271
|
+
setInterval: ({ call }) => createSetInterval((delay, timerId) => call('set', { delay, now: performance.timeOrigin + performance.now(), timerId, timerType: 'interval' })),
|
|
272
|
+
setTimeout: ({ call }) => createSetTimeout((delay, timerId) => call('set', { delay, now: performance.timeOrigin + performance.now(), timerId, timerType: 'timeout' }))
|
|
279
273
|
});
|
|
280
274
|
const load = (url) => {
|
|
281
275
|
const worker = new Worker(url);
|
|
@@ -298,7 +292,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
298
292
|
};
|
|
299
293
|
|
|
300
294
|
// This is the minified and stringified code of the worker-timers-worker package.
|
|
301
|
-
const worker = `(()=>{var e={455
|
|
295
|
+
const worker = `(()=>{var e={455(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),l=t(c);e.addUniqueNumber=l,e.generateUniqueNumber=c}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";const e=-32603,t=-32602,n=-32601,o=(e,t)=>Object.assign(new Error(e),{status:t}),s=t=>o('The handler of the method called "'.concat(t,'" returned an unexpected result.'),e),a=(t,r)=>async({data:{id:a,method:i,params:u}})=>{const c=r[i];try{if(void 0===c)throw(e=>o('The requested method called "'.concat(e,'" is not supported.'),n))(i);const r=void 0===u?c():c(u);if(void 0===r)throw(t=>o('The handler of the method called "'.concat(t,'" returned no required result.'),e))(i);const l=r instanceof Promise?await r:r;if(null===a){if(void 0!==l.result)throw s(i)}else{if(void 0===l.result)throw s(i);const{result:e,transferables:r=[]}=l;t.postMessage({id:a,result:e},r)}}catch(e){const{message:r,status:n=-32603}=e;t.postMessage({error:{code:n,message:r},id:a})}};var i=r(455);const u=new Map,c=(e,r,n)=>({...r,connect:({port:t})=>{t.start();const n=e(t,r),o=(0,i.generateUniqueNumber)(u);return u.set(o,()=>{n(),t.close(),u.delete(o)}),{result:o}},disconnect:({portId:e})=>{const r=u.get(e);if(void 0===r)throw(e=>o('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),t))(e);return r(),{result:null}},isSupported:async()=>{if(await new Promise(e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=({data:t})=>e(null!==t),n.postMessage(t,[t])})){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),l=(e,t,r=()=>!0)=>{const n=c(l,t,r),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},d=(e,t)=>r=>{const n=t.get(r);if(void 0===n)return Promise.resolve(!1);const[o,s]=n;return e(o),t.delete(r),s(!1),Promise.resolve(!0)},m=(e,t,r,n)=>(o,s,a)=>{const i=o+s-t.timeOrigin,u=i-t.now();return new Promise(t=>{e.set(a,[r(n,u,i,e,t,a),t])})},f=new Map,h=d(globalThis.clearTimeout,f),p=new Map,v=d(globalThis.clearTimeout,p),w=((e,t)=>{const r=(n,o,s,a)=>{const i=n-e.now();i>0?o.set(a,[t(r,i,n,o,s,a),s]):(o.delete(a),s(!0))};return r})(performance,globalThis.setTimeout),g=m(f,performance,globalThis.setTimeout,w),T=m(p,performance,globalThis.setTimeout,w);l(self,{clear:async({timerId:e,timerType:t})=>({result:await("interval"===t?h(e):v(e))}),set:async({delay:e,now:t,timerId:r,timerType:n})=>({result:await("interval"===n?g:T)(e,t,r)})})})()})();`; // tslint:disable-line:max-line-length
|
|
302
296
|
|
|
303
297
|
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
|
|
304
298
|
const clearInterval$1 = (timerId) => loadOrReturnBroker().clearInterval(timerId);
|
|
@@ -526,13 +520,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
526
520
|
},
|
|
527
521
|
};
|
|
528
522
|
|
|
529
|
-
const version = "1.
|
|
530
|
-
|
|
531
|
-
/* 数据 */
|
|
532
|
-
const GlobalData = {
|
|
533
|
-
/** .on添加在元素存储的事件 */
|
|
534
|
-
domEventSymbol: Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)),
|
|
535
|
-
};
|
|
523
|
+
const version = "1.8.1";
|
|
536
524
|
|
|
537
525
|
class ElementSelector {
|
|
538
526
|
windowApi;
|
|
@@ -1625,6 +1613,12 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
1625
1613
|
}
|
|
1626
1614
|
new ElementAnimate();
|
|
1627
1615
|
|
|
1616
|
+
/* 数据 */
|
|
1617
|
+
const GlobalData = {
|
|
1618
|
+
/** .on添加在元素存储的事件 */
|
|
1619
|
+
domEventSymbol: Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)),
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1628
1622
|
const OriginPrototype = {
|
|
1629
1623
|
Object: {
|
|
1630
1624
|
defineProperty: Object.defineProperty,
|
|
@@ -1684,7 +1678,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
1684
1678
|
if (element == null) {
|
|
1685
1679
|
return {
|
|
1686
1680
|
off() { },
|
|
1687
|
-
|
|
1681
|
+
emit() { },
|
|
1688
1682
|
};
|
|
1689
1683
|
}
|
|
1690
1684
|
let $elList = [];
|
|
@@ -1819,10 +1813,10 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
1819
1813
|
/**
|
|
1820
1814
|
* 主动触发事件
|
|
1821
1815
|
* @param details 赋予触发的Event的额外属性,如果是Event类型,那么将自动代替默认new的Event对象
|
|
1822
|
-
* @param
|
|
1816
|
+
* @param useDispatchToEmit 是否使用dispatchEvent来触发事件,默认true,如果为false,则直接调用callback,但是这种会让使用了selectorTarget的没有值
|
|
1823
1817
|
*/
|
|
1824
|
-
|
|
1825
|
-
that.
|
|
1818
|
+
emit: (details, useDispatchToEmit) => {
|
|
1819
|
+
that.emit($elList, eventTypeList, details, useDispatchToEmit);
|
|
1826
1820
|
},
|
|
1827
1821
|
};
|
|
1828
1822
|
}
|
|
@@ -2001,7 +1995,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2001
1995
|
});
|
|
2002
1996
|
});
|
|
2003
1997
|
}
|
|
2004
|
-
|
|
1998
|
+
onReady(...args) {
|
|
2005
1999
|
const callback = args[0];
|
|
2006
2000
|
// 异步回调
|
|
2007
2001
|
let resolve = void 0;
|
|
@@ -2095,16 +2089,16 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2095
2089
|
* @param element 需要触发的元素|元素数组|window
|
|
2096
2090
|
* @param eventType 需要触发的事件
|
|
2097
2091
|
* @param details 赋予触发的Event的额外属性,如果是Event类型,那么将自动代替默认new的Event对象
|
|
2098
|
-
* @param
|
|
2092
|
+
* @param useDispatchToEmit 是否使用dispatchEvent来触发事件,默认true,如果为false,则直接调用callback,但是这种会让使用了selectorTarget的没有值
|
|
2099
2093
|
* @example
|
|
2100
2094
|
* // 触发元素a.xx的click事件
|
|
2101
|
-
* DOMUtils.
|
|
2102
|
-
* DOMUtils.
|
|
2095
|
+
* DOMUtils.emit(document.querySelector("a.xx"),"click")
|
|
2096
|
+
* DOMUtils.emit("a.xx","click")
|
|
2103
2097
|
* // 触发元素a.xx的click、tap、hover事件
|
|
2104
|
-
* DOMUtils.
|
|
2105
|
-
* DOMUtils.
|
|
2098
|
+
* DOMUtils.emit(document.querySelector("a.xx"),"click tap hover")
|
|
2099
|
+
* DOMUtils.emit("a.xx",["click","tap","hover"])
|
|
2106
2100
|
*/
|
|
2107
|
-
|
|
2101
|
+
emit(element, eventType, details, useDispatchToEmit = true) {
|
|
2108
2102
|
const that = this;
|
|
2109
2103
|
if (typeof element === "string") {
|
|
2110
2104
|
element = that.selectorAll(element);
|
|
@@ -2146,7 +2140,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2146
2140
|
});
|
|
2147
2141
|
}
|
|
2148
2142
|
}
|
|
2149
|
-
if (
|
|
2143
|
+
if (useDispatchToEmit == false && eventTypeItem in elementEvents) {
|
|
2150
2144
|
// 直接调用监听的事件
|
|
2151
2145
|
elementEvents[eventTypeItem].forEach((eventsItem) => {
|
|
2152
2146
|
eventsItem.callback(event);
|
|
@@ -2159,11 +2153,11 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2159
2153
|
});
|
|
2160
2154
|
}
|
|
2161
2155
|
/**
|
|
2162
|
-
*
|
|
2156
|
+
* 监听或触发元素的click事件
|
|
2163
2157
|
* @param element 目标元素
|
|
2164
2158
|
* @param handler (可选)事件处理函数
|
|
2165
2159
|
* @param details (可选)赋予触发的Event的额外属性
|
|
2166
|
-
* @param
|
|
2160
|
+
* @param useDispatchToEmit (可选)是否使用dispatchEvent来触发事件,默认true
|
|
2167
2161
|
* @example
|
|
2168
2162
|
* // 触发元素a.xx的click事件
|
|
2169
2163
|
* DOMUtils.click(document.querySelector("a.xx"))
|
|
@@ -2172,7 +2166,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2172
2166
|
* console.log("触发click事件成功")
|
|
2173
2167
|
* })
|
|
2174
2168
|
* */
|
|
2175
|
-
click(element, handler, details,
|
|
2169
|
+
click(element, handler, details, useDispatchToEmit) {
|
|
2176
2170
|
const that = this;
|
|
2177
2171
|
if (typeof element === "string") {
|
|
2178
2172
|
element = that.selectorAll(element);
|
|
@@ -2183,23 +2177,23 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2183
2177
|
if (CommonUtils.isNodeList(element)) {
|
|
2184
2178
|
// 设置
|
|
2185
2179
|
element.forEach(($ele) => {
|
|
2186
|
-
that.click($ele, handler, details,
|
|
2180
|
+
that.click($ele, handler, details, useDispatchToEmit);
|
|
2187
2181
|
});
|
|
2188
2182
|
return;
|
|
2189
2183
|
}
|
|
2190
2184
|
if (handler == null) {
|
|
2191
|
-
that.
|
|
2185
|
+
that.emit(element, "click", details, useDispatchToEmit);
|
|
2192
2186
|
}
|
|
2193
2187
|
else {
|
|
2194
2188
|
that.on(element, "click", null, handler);
|
|
2195
2189
|
}
|
|
2196
2190
|
}
|
|
2197
2191
|
/**
|
|
2198
|
-
*
|
|
2192
|
+
* 监听或触发元素的blur事件
|
|
2199
2193
|
* @param element 目标元素
|
|
2200
2194
|
* @param handler (可选)事件处理函数
|
|
2201
2195
|
* @param details (可选)赋予触发的Event的额外属性
|
|
2202
|
-
* @param
|
|
2196
|
+
* @param useDispatchToEmit (可选)是否使用dispatchEvent来触发事件,默认true
|
|
2203
2197
|
* @example
|
|
2204
2198
|
* // 触发元素a.xx的blur事件
|
|
2205
2199
|
* DOMUtils.blur(document.querySelector("a.xx"))
|
|
@@ -2208,7 +2202,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2208
2202
|
* console.log("触发blur事件成功")
|
|
2209
2203
|
* })
|
|
2210
2204
|
* */
|
|
2211
|
-
blur(element, handler, details,
|
|
2205
|
+
blur(element, handler, details, useDispatchToEmit) {
|
|
2212
2206
|
const that = this;
|
|
2213
2207
|
if (typeof element === "string") {
|
|
2214
2208
|
element = that.selectorAll(element);
|
|
@@ -2219,23 +2213,23 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2219
2213
|
if (CommonUtils.isNodeList(element)) {
|
|
2220
2214
|
// 设置
|
|
2221
2215
|
element.forEach(($ele) => {
|
|
2222
|
-
that.focus($ele, handler, details,
|
|
2216
|
+
that.focus($ele, handler, details, useDispatchToEmit);
|
|
2223
2217
|
});
|
|
2224
2218
|
return;
|
|
2225
2219
|
}
|
|
2226
2220
|
if (handler === null) {
|
|
2227
|
-
that.
|
|
2221
|
+
that.emit(element, "blur", details, useDispatchToEmit);
|
|
2228
2222
|
}
|
|
2229
2223
|
else {
|
|
2230
2224
|
that.on(element, "blur", null, handler);
|
|
2231
2225
|
}
|
|
2232
2226
|
}
|
|
2233
2227
|
/**
|
|
2234
|
-
*
|
|
2228
|
+
* 监听或触发元素的focus事件
|
|
2235
2229
|
* @param element 目标元素
|
|
2236
2230
|
* @param handler (可选)事件处理函数
|
|
2237
2231
|
* @param details (可选)赋予触发的Event的额外属性
|
|
2238
|
-
* @param
|
|
2232
|
+
* @param useDispatchToEmit (可选)是否使用dispatchEvent来触发事件,默认true
|
|
2239
2233
|
* @example
|
|
2240
2234
|
* // 触发元素a.xx的focus事件
|
|
2241
2235
|
* DOMUtils.focus(document.querySelector("a.xx"))
|
|
@@ -2244,7 +2238,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2244
2238
|
* console.log("触发focus事件成功")
|
|
2245
2239
|
* })
|
|
2246
2240
|
* */
|
|
2247
|
-
focus(element, handler, details,
|
|
2241
|
+
focus(element, handler, details, useDispatchToEmit) {
|
|
2248
2242
|
const that = this;
|
|
2249
2243
|
if (typeof element === "string") {
|
|
2250
2244
|
element = that.selectorAll(element);
|
|
@@ -2255,12 +2249,12 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2255
2249
|
if (CommonUtils.isNodeList(element)) {
|
|
2256
2250
|
// 设置
|
|
2257
2251
|
element.forEach(($ele) => {
|
|
2258
|
-
that.focus($ele, handler, details,
|
|
2252
|
+
that.focus($ele, handler, details, useDispatchToEmit);
|
|
2259
2253
|
});
|
|
2260
2254
|
return;
|
|
2261
2255
|
}
|
|
2262
2256
|
if (handler == null) {
|
|
2263
|
-
that.
|
|
2257
|
+
that.emit(element, "focus", details, useDispatchToEmit);
|
|
2264
2258
|
}
|
|
2265
2259
|
else {
|
|
2266
2260
|
that.on(element, "focus", null, handler);
|
|
@@ -2273,14 +2267,14 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2273
2267
|
* @param option 配置
|
|
2274
2268
|
* @example
|
|
2275
2269
|
* // 监听a.xx元素的移入或移出
|
|
2276
|
-
* DOMUtils.
|
|
2270
|
+
* DOMUtils.onHover(document.querySelector("a.xx"),()=>{
|
|
2277
2271
|
* console.log("移入/移除");
|
|
2278
2272
|
* })
|
|
2279
|
-
* DOMUtils.
|
|
2273
|
+
* DOMUtils.onHover("a.xx",()=>{
|
|
2280
2274
|
* console.log("移入/移除");
|
|
2281
2275
|
* })
|
|
2282
2276
|
*/
|
|
2283
|
-
|
|
2277
|
+
onHover(element, handler, option) {
|
|
2284
2278
|
const that = this;
|
|
2285
2279
|
if (typeof element === "string") {
|
|
2286
2280
|
element = that.selectorAll(element);
|
|
@@ -2291,7 +2285,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2291
2285
|
if (CommonUtils.isNodeList(element)) {
|
|
2292
2286
|
// 设置
|
|
2293
2287
|
element.forEach(($ele) => {
|
|
2294
|
-
that.
|
|
2288
|
+
that.onHover($ele, handler, option);
|
|
2295
2289
|
});
|
|
2296
2290
|
return;
|
|
2297
2291
|
}
|
|
@@ -2299,12 +2293,12 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2299
2293
|
that.on(element, "mouseleave", null, handler, option);
|
|
2300
2294
|
}
|
|
2301
2295
|
/**
|
|
2302
|
-
*
|
|
2296
|
+
* 监听动画结束
|
|
2303
2297
|
* @param element 监听的元素
|
|
2304
2298
|
* @param handler 触发的回调函数
|
|
2305
2299
|
* @param option 配置项,这里默认配置once为true
|
|
2306
2300
|
*/
|
|
2307
|
-
|
|
2301
|
+
onAnimationend(element, handler, option) {
|
|
2308
2302
|
const that = this;
|
|
2309
2303
|
if (typeof element === "string") {
|
|
2310
2304
|
element = that.selector(element);
|
|
@@ -2327,12 +2321,12 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2327
2321
|
}
|
|
2328
2322
|
}
|
|
2329
2323
|
/**
|
|
2330
|
-
*
|
|
2324
|
+
* 监听过渡结束
|
|
2331
2325
|
* @param element 监听的元素
|
|
2332
2326
|
* @param handler 触发的回调函数
|
|
2333
2327
|
* @param option 配置项,这里默认配置once为true
|
|
2334
2328
|
*/
|
|
2335
|
-
|
|
2329
|
+
onTransitionend(element, handler, option) {
|
|
2336
2330
|
const that = this;
|
|
2337
2331
|
if (typeof element === "string") {
|
|
2338
2332
|
element = that.selector(element);
|
|
@@ -2369,7 +2363,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2369
2363
|
* console.log("按键松开");
|
|
2370
2364
|
* })
|
|
2371
2365
|
*/
|
|
2372
|
-
|
|
2366
|
+
onKeyup(element, handler, option) {
|
|
2373
2367
|
const that = this;
|
|
2374
2368
|
if (element == null) {
|
|
2375
2369
|
return;
|
|
@@ -2380,7 +2374,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2380
2374
|
if (CommonUtils.isNodeList(element)) {
|
|
2381
2375
|
// 设置
|
|
2382
2376
|
element.forEach(($ele) => {
|
|
2383
|
-
that.
|
|
2377
|
+
that.onKeyup($ele, handler, option);
|
|
2384
2378
|
});
|
|
2385
2379
|
return;
|
|
2386
2380
|
}
|
|
@@ -2401,7 +2395,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2401
2395
|
* console.log("按键按下");
|
|
2402
2396
|
* })
|
|
2403
2397
|
*/
|
|
2404
|
-
|
|
2398
|
+
onKeydown(element, handler, option) {
|
|
2405
2399
|
const that = this;
|
|
2406
2400
|
if (element == null) {
|
|
2407
2401
|
return;
|
|
@@ -2412,7 +2406,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2412
2406
|
if (CommonUtils.isNodeList(element)) {
|
|
2413
2407
|
// 设置
|
|
2414
2408
|
element.forEach(($ele) => {
|
|
2415
|
-
that.
|
|
2409
|
+
that.onKeydown($ele, handler, option);
|
|
2416
2410
|
});
|
|
2417
2411
|
return;
|
|
2418
2412
|
}
|
|
@@ -2433,7 +2427,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2433
2427
|
* console.log("按键按下");
|
|
2434
2428
|
* })
|
|
2435
2429
|
*/
|
|
2436
|
-
|
|
2430
|
+
onKeypress(element, handler, option) {
|
|
2437
2431
|
const that = this;
|
|
2438
2432
|
if (element == null) {
|
|
2439
2433
|
return;
|
|
@@ -2444,76 +2438,76 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2444
2438
|
if (CommonUtils.isNodeList(element)) {
|
|
2445
2439
|
// 设置
|
|
2446
2440
|
element.forEach(($ele) => {
|
|
2447
|
-
that.
|
|
2441
|
+
that.onKeypress($ele, handler, option);
|
|
2448
2442
|
});
|
|
2449
2443
|
return;
|
|
2450
2444
|
}
|
|
2451
2445
|
that.on(element, "keypress", null, handler, option);
|
|
2452
2446
|
}
|
|
2453
2447
|
/**
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2448
|
+
* 监听某个元素键盘按键事件或window全局按键事件
|
|
2449
|
+
* 按下有值的键时触发,按下Ctrl\Alt\Shift\Meta是无值键。按下先触发keydown事件,再触发keypress事件。
|
|
2450
|
+
* @param element 需要监听的对象,可以是全局Window或者某个元素
|
|
2451
|
+
* @param eventName 事件名,默认keypress,keydown - > keypress - > keyup
|
|
2452
|
+
* @param handler 自己定义的回调事件,参数1为当前的key,参数2为组合按键,数组类型,包含ctrl、shift、alt和meta(win键或mac的cmd键)
|
|
2459
2453
|
* @param options 监听事件的配置
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2454
|
+
* @example
|
|
2455
|
+
Utils.onKeyboard(window,(keyName,keyValue,otherKey,event)=>{
|
|
2456
|
+
if(keyName === "Enter"){
|
|
2457
|
+
console.log("回车按键的值是:"+keyValue)
|
|
2458
|
+
}
|
|
2459
|
+
if(otherKey.indexOf("ctrl") && keyName === "Enter" ){
|
|
2460
|
+
console.log("Ctrl和回车键");
|
|
2461
|
+
}
|
|
2462
|
+
})
|
|
2463
|
+
* @example
|
|
2464
|
+
字母和数字键的键码值(keyCode)
|
|
2465
|
+
按键 键码 按键 键码 按键 键码 按键 键码
|
|
2466
|
+
A 65 J 74 S 83 1 49
|
|
2467
|
+
B 66 K 75 T 84 2 50
|
|
2468
|
+
C 67 L 76 U 85 3 51
|
|
2469
|
+
D 68 M 77 V 86 4 52
|
|
2470
|
+
E 69 N 78 W 87 5 53
|
|
2471
|
+
F 70 O 79 X 88 6 54
|
|
2472
|
+
G 71 P 80 Y 89 7 55
|
|
2473
|
+
H 72 Q 81 Z 90 8 56
|
|
2474
|
+
I 73 R 82 0 48 9 57
|
|
2475
|
+
|
|
2476
|
+
数字键盘上的键的键码值(keyCode)
|
|
2477
|
+
功能键键码值(keyCode)
|
|
2478
|
+
按键 键码 按键 键码 按键 键码 按键 键码
|
|
2479
|
+
0 96 8 104 F1 112 F7 118
|
|
2480
|
+
1 97 9 105 F2 113 F8 119
|
|
2481
|
+
2 98 * 106 F3 114 F9 120
|
|
2482
|
+
3 99 + 107 F4 115 F10 121
|
|
2483
|
+
4 100 Enter 108 F5 116 F11 122
|
|
2484
|
+
5 101 - 109 F6 117 F12 123
|
|
2485
|
+
6 102 . 110
|
|
2486
|
+
7 103 / 111
|
|
2487
|
+
|
|
2488
|
+
控制键键码值(keyCode)
|
|
2489
|
+
按键 键码 按键 键码 按键 键码 按键 键码
|
|
2490
|
+
BackSpace 8 Esc 27 → 39 -_ 189
|
|
2491
|
+
Tab 9 Spacebar 32 ↓ 40 .> 190
|
|
2492
|
+
Clear 12 Page Up 33 Insert 45 /? 191
|
|
2493
|
+
Enter 13 Page Down 34 Delete 46 `~ 192
|
|
2494
|
+
Shift 16 End 35 Num Lock 144 [{ 219
|
|
2495
|
+
Control 17 Home 36 ;: 186 \| 220
|
|
2496
|
+
Alt 18 ← 37 =+ 187 ]} 221
|
|
2497
|
+
Cape Lock 20 ↑ 38 ,< 188 '" 222
|
|
2498
|
+
|
|
2499
|
+
多媒体键码值(keyCode)
|
|
2500
|
+
按键 键码
|
|
2501
|
+
音量加 175
|
|
2502
|
+
音量减 174
|
|
2503
|
+
停止 179
|
|
2504
|
+
静音 173
|
|
2505
|
+
浏览器 172
|
|
2506
|
+
邮件 180
|
|
2507
|
+
搜索 170
|
|
2508
|
+
收藏 171
|
|
2509
|
+
**/
|
|
2510
|
+
onKeyboard(element, eventName = "keypress", handler, options) {
|
|
2517
2511
|
const that = this;
|
|
2518
2512
|
if (typeof element === "string") {
|
|
2519
2513
|
element = that.selectorAll(element);
|
|
@@ -2537,8 +2531,8 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2537
2531
|
if (event.shiftKey) {
|
|
2538
2532
|
otherCodeList.push("shift");
|
|
2539
2533
|
}
|
|
2540
|
-
if (typeof
|
|
2541
|
-
|
|
2534
|
+
if (typeof handler === "function") {
|
|
2535
|
+
handler(keyName, keyValue, otherCodeList, event);
|
|
2542
2536
|
}
|
|
2543
2537
|
};
|
|
2544
2538
|
that.on(element, eventName, keyboardEventCallBack, options);
|
|
@@ -2548,6 +2542,122 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2548
2542
|
},
|
|
2549
2543
|
};
|
|
2550
2544
|
}
|
|
2545
|
+
/**
|
|
2546
|
+
* 监input、textarea的输入框值改变的事件(当输入法输入时,不会触发该监听)
|
|
2547
|
+
* @param $el 输入框元素
|
|
2548
|
+
* @param handler 回调函数
|
|
2549
|
+
* @param option 配置
|
|
2550
|
+
*/
|
|
2551
|
+
onInput($el, handler, option) {
|
|
2552
|
+
/**
|
|
2553
|
+
* 是否正在输入中
|
|
2554
|
+
*/
|
|
2555
|
+
let isComposite = false;
|
|
2556
|
+
const __callback = async (event) => {
|
|
2557
|
+
if (isComposite)
|
|
2558
|
+
return;
|
|
2559
|
+
await handler(event);
|
|
2560
|
+
};
|
|
2561
|
+
const __composition_start_callback = () => {
|
|
2562
|
+
isComposite = true;
|
|
2563
|
+
};
|
|
2564
|
+
const __composition_end_callback = () => {
|
|
2565
|
+
isComposite = false;
|
|
2566
|
+
this.emit($el, "input", {
|
|
2567
|
+
isComposite,
|
|
2568
|
+
});
|
|
2569
|
+
};
|
|
2570
|
+
const inputListener = this.on($el, "input", __callback, option);
|
|
2571
|
+
const compositionStartListener = this.on($el, "compositionstart", __composition_start_callback, option);
|
|
2572
|
+
const compositionEndListener = this.on($el, "compositionend", __composition_end_callback, option);
|
|
2573
|
+
return {
|
|
2574
|
+
off: () => {
|
|
2575
|
+
inputListener.off();
|
|
2576
|
+
compositionStartListener.off();
|
|
2577
|
+
compositionEndListener.off();
|
|
2578
|
+
},
|
|
2579
|
+
};
|
|
2580
|
+
}
|
|
2581
|
+
onDoubleClick(...args) {
|
|
2582
|
+
const $el = args[0];
|
|
2583
|
+
let selector = void 0;
|
|
2584
|
+
let handler;
|
|
2585
|
+
let options;
|
|
2586
|
+
if (args.length === 2) {
|
|
2587
|
+
if (typeof args[1] === "function") {
|
|
2588
|
+
handler = args[1];
|
|
2589
|
+
}
|
|
2590
|
+
else {
|
|
2591
|
+
throw new TypeError("handler is not a function");
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
else if (args.length === 3) {
|
|
2595
|
+
if (typeof args[1] === "function") {
|
|
2596
|
+
handler = args[1];
|
|
2597
|
+
options = args[2];
|
|
2598
|
+
}
|
|
2599
|
+
else {
|
|
2600
|
+
selector = args[1];
|
|
2601
|
+
handler = args[2];
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
else if (args.length === 4) {
|
|
2605
|
+
selector = args[1];
|
|
2606
|
+
handler = args[2];
|
|
2607
|
+
options = args[3];
|
|
2608
|
+
}
|
|
2609
|
+
else {
|
|
2610
|
+
throw new Error("args length error");
|
|
2611
|
+
}
|
|
2612
|
+
let $click = null;
|
|
2613
|
+
let isDoubleClick = false;
|
|
2614
|
+
let timer = void 0;
|
|
2615
|
+
/** 是否是移动端点击 */
|
|
2616
|
+
let isMobileTouch = false;
|
|
2617
|
+
const dblclick_handler = async (evt, option) => {
|
|
2618
|
+
if (evt.type === "dblclick" && isMobileTouch) {
|
|
2619
|
+
// 禁止在移动端触发dblclick事件
|
|
2620
|
+
return;
|
|
2621
|
+
}
|
|
2622
|
+
await handler(evt, option);
|
|
2623
|
+
};
|
|
2624
|
+
const dblClickListener = this.on($el, "dblclick", (evt) => {
|
|
2625
|
+
dblclick_handler(evt, {
|
|
2626
|
+
isDoubleClick: true,
|
|
2627
|
+
});
|
|
2628
|
+
}, options);
|
|
2629
|
+
const touchEndListener = this.on($el, "touchend", selector, (evt, selectorTarget) => {
|
|
2630
|
+
isMobileTouch = true;
|
|
2631
|
+
CommonUtils.clearTimeout(timer);
|
|
2632
|
+
timer = void 0;
|
|
2633
|
+
if (isDoubleClick && $click === selectorTarget) {
|
|
2634
|
+
isDoubleClick = false;
|
|
2635
|
+
$click = null;
|
|
2636
|
+
/* 判定为双击 */
|
|
2637
|
+
dblclick_handler(evt, {
|
|
2638
|
+
isDoubleClick: true,
|
|
2639
|
+
});
|
|
2640
|
+
}
|
|
2641
|
+
else {
|
|
2642
|
+
timer = CommonUtils.setTimeout(() => {
|
|
2643
|
+
isDoubleClick = false;
|
|
2644
|
+
// 判断为单击
|
|
2645
|
+
dblclick_handler(evt, {
|
|
2646
|
+
isDoubleClick: false,
|
|
2647
|
+
});
|
|
2648
|
+
}, 200);
|
|
2649
|
+
isDoubleClick = true;
|
|
2650
|
+
$click = selectorTarget;
|
|
2651
|
+
}
|
|
2652
|
+
}, options);
|
|
2653
|
+
return {
|
|
2654
|
+
off() {
|
|
2655
|
+
$click = null;
|
|
2656
|
+
dblClickListener.off();
|
|
2657
|
+
touchEndListener.off();
|
|
2658
|
+
},
|
|
2659
|
+
};
|
|
2660
|
+
}
|
|
2551
2661
|
preventEvent(...args) {
|
|
2552
2662
|
/**
|
|
2553
2663
|
* 阻止事件的默认行为发生,并阻止事件传播
|