MCPcopy
hub / github.com/flatpickr/flatpickr / triggerEvent

Function triggerEvent

src/index.ts:2729–2746  ·  view source on GitHub ↗
(event: HookKey, data?: any)

Source from the content-addressed store, hash-verified

2727 }
2728
2729 function triggerEvent(event: HookKey, data?: any) {
2730 // If the instance has been destroyed already, all hooks have been removed
2731 if (self.config === undefined) return;
2732
2733 const hooks = self.config[event];
2734
2735 if (hooks !== undefined && hooks.length > 0) {
2736 for (let i = 0; hooks[i] && i < hooks.length; i++)
2737 hooks[i](self.selectedDates, self.input.value, self, data);
2738 }
2739
2740 if (event === "onChange") {
2741 self.input.dispatchEvent(createEvent("change"));
2742
2743 // many front-end frameworks bind to the input event
2744 self.input.dispatchEvent(createEvent("input"));
2745 }
2746 }
2747
2748 function createEvent(name: string): Event {
2749 const e = document.createEvent("Event");

Callers 15

initFunction · 0.85
triggerChangeFunction · 0.85
jumpToDateFunction · 0.85
createDayFunction · 0.85
buildMonthFunction · 0.85
changeMonthFunction · 0.85
clearFunction · 0.85
closeFunction · 0.85
destroyFunction · 0.85
changeYearFunction · 0.85
onKeyDownFunction · 0.85
openFunction · 0.85

Calls 1

createEventFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…