UNPKG

@exadel/esl

Version:

Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components

35 lines (34 loc) 1.89 kB
import type { Point } from '../point'; /** Checks if the passed event is {@link MouseEvent} */ export declare const isMouseEvent: (event: Event) => event is MouseEvent; /** Checks if the passed event is {@link TouchEvent} */ export declare const isTouchEvent: (event: Event) => event is TouchEvent; /** Checks if the passed event is {@link PointerEvent} */ export declare const isPointerEvent: (event: Event) => event is PointerEvent; /** * @returns true if the passed event should be passive by default * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md */ export declare const isPassiveByDefault: (event: string) => boolean; /** Gets the original CustomEvent source in case event bubbles from Shadow DOM */ export declare const getCompositeTarget: (e: CustomEvent) => EventTarget | null; /** @returns touch point coordinates of {@link TouchEvent} or {@link PointerEvent} */ export declare const getTouchPoint: (event: TouchEvent | PointerEvent | MouseEvent) => Point; /** @returns element offset point coordinates */ export declare const getOffsetPoint: (el: Element) => Point; /** * Dispatches custom event. * Event bubbles and is cancelable by default, use `eventInit` to override that. * @param el - EventTarget to dispatch event * @param eventName - name of the event to dispatch * @param eventInit - object that specifies characteristics of the event. See {@link CustomEventInit} */ export declare const dispatchCustomEvent: (el: EventTarget, eventName: string, eventInit?: CustomEventInit) => boolean; /** * Overrides {@link Event} `target` property * @param event - {@link Event} to override * @param key - {@link Event} property * @param target - {@link EventTarget} to setup * @returns original event */ export declare const overrideEvent: (event: Event, key: keyof Event, target: null | EventTarget | (() => null | EventTarget)) => Event;