All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.module-min.event.js Maven / Gradle / Ivy

The newest version!
import{EventOptions}from"./type.js";import Mikado from"./mikado.js";const events={},event_options={},routes=Object.create(null),options=Object.create(null),doc=document.documentElement||document.body.parentNode,has_touch="ontouchstart"in window,has_pointer=!has_touch&&window.PointerEvent&&navigator.maxTouchPoints;Mikado.eventCache=!1,Mikado.eventBubble=!1;let tap_fallback;export function handler(a,b){const c=a.target;if(c===window||c===doc)return;const d=Mikado.eventCache,e=Mikado.eventBubble;b||(b=a.type);let f;if(d&&(f=c["_mke"+b]),"undefined"==typeof f){for(let a=c;a&&a!==doc;){let g;if("click"===b&&tap_fallback&&(g=a.getAttribute("tap")),g||(g=a.getAttribute(b)),g){const h=g.indexOf(":");let i=a;if(-1Math.abs(touch_x-b)&&15>Math.abs(touch_y-d)&&handler(a,"tap")}function c(a,b){b&&(a=b[0]),touch_x=a.clientX,touch_y=a.clientY}const d={passive:!1,capture:!0};register_tap=function(c){register_event(c,has_pointer?"pointerdown":"touchstart",a,d),register_event(c,has_pointer?"pointerup":"touchend",b,d)}}function register_event(a,b,c,d){if(!1,"tap"===b){if(has_touch||has_pointer)return void register_tap(a);tap_fallback=!0,b="click"}window[(a?"add":"remove")+"EventListener"](b,c,!(d||!1===d)||d)}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy