mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(dom) touchstart: set passive listener
https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
This commit is contained in:
parent
aa8916aea5
commit
97c50d588f
2 changed files with 11 additions and 4 deletions
|
|
@ -7,6 +7,15 @@ module.exports = new EventsProto();
|
|||
function EventsProto() {
|
||||
const Events = this;
|
||||
|
||||
const getEventOptions = (eventName) => {
|
||||
if (eventName !== 'touchstart')
|
||||
return false;
|
||||
|
||||
return {
|
||||
passive: true
|
||||
};
|
||||
};
|
||||
|
||||
function parseArgs(eventName, element, listener, callback) {
|
||||
let isFunc;
|
||||
const args = [
|
||||
|
|
@ -47,7 +56,7 @@ function EventsProto() {
|
|||
callback(element, [
|
||||
eventName,
|
||||
listener,
|
||||
false
|
||||
getEventOptions(eventName),
|
||||
]);
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ const EventsFiles = {
|
|||
]),
|
||||
dragstart: exec.with(execIfNotUL, onDragStart),
|
||||
dblclick: exec.with(execIfNotUL, onDblClick),
|
||||
touchstart: exec.with(execIfNotUL, onTouch)
|
||||
touchstart: exec.with(execIfNotUL, onTouch),
|
||||
};
|
||||
|
||||
let EXT;
|
||||
|
|
@ -292,8 +292,6 @@ function onTouch(event) {
|
|||
CloudCmd.loadDir({
|
||||
path: DOM.getCurrentPath(current)
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue