MCPcopy
hub / github.com/flatpickr/flatpickr / bind

Function bind

src/index.ts:385–401  ·  view source on GitHub ↗

* Essentially addEventListener + tracking * @param {Element} element the element to addEventListener to * @param {String} event the event name * @param {Function} handler the event handler

(
    element: E | E[],
    event: string | string[],
    handler: (e?: any) => void,
    options?: { capture?: boolean; once?: boolean; passive?: boolean }
  )

Source from the content-addressed store, hash-verified

383 * @param {Function} handler the event handler
384 */
385 function bind<E extends Element | Window | Document>(
386 element: E | E[],
387 event: string | string[],
388 handler: (e?: any) => void,
389 options?: { capture?: boolean; once?: boolean; passive?: boolean }
390 ): void {
391 if (event instanceof Array)
392 return event.forEach((ev) => bind(element, ev, handler, options));
393
394 if (element instanceof Array)
395 return element.forEach((el) => bind(el, event, handler, options));
396
397 element.addEventListener(event, handler, options);
398 self._handlers.push({
399 remove: () => element.removeEventListener(event, handler, options),
400 });
401 }
402
403 function triggerChange() {
404 triggerEvent("onChange");

Callers 4

bindEventsFunction · 0.85
buildMonthFunction · 0.85
FlatpickrInstanceFunction · 0.85
setupMobileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…