UNPKG

vanillajs-browser-helpers

Version:

Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS in the browser

21 lines (20 loc) 919 B
/** * Bind an event handler for one or more event names on a given DOM element. * * @param elm - DOM element to bind the event to * @param eventNames - Event names to bind the handler to * @param handler - Handler to bind to the event * @param options - Options to pass to the 'addEventListener' * @return `elm` */ declare function on(elm: EventTarget, eventNames: string | string[], handler: EventListenerOrEventListenerObject, options?: AddEventListenerOptions): EventTarget; /** * Bind an event handler for one or more event names to `document` * * @param eventNames - Event names to bind the handler to * @param handler - Handler to bind to the event * @param options - Options to pass to the 'addEventListener' * @return `document` */ declare function on(eventNames: string | string[], handler: EventListenerOrEventListenerObject, options?: AddEventListenerOptions): EventTarget; export default on;