UNPKG

hd-utils

Version:

A handy utils for modern JS developers

7 lines (6 loc) 413 B
import { Fn } from '../types'; /** * @description will check if the passed object accepts addEventListener and add it. * @example addEventListener(event.target, "touchend", preventDefault, { passive: false }); */ export default function addEventListener<T extends Window | Document | HTMLElement | EventTarget>(obj: T | null, ...args: Parameters<T['addEventListener']>[] | [string, Fn | null, ...any]): void;