Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the default events to be emitted #59

Closed
7 of 12 tasks
ankurk91 opened this issue Jan 30, 2018 · 6 comments
Closed
7 of 12 tasks

Limit the default events to be emitted #59

ankurk91 opened this issue Jan 30, 2018 · 6 comments
Assignees
Milestone

Comments

@ankurk91
Copy link
Owner

ankurk91 commented Jan 30, 2018

Right now component listen to all events available in flatpickr, i want to reduce the events list.

Here is events list and i have marked the events i want to keep -

  • onChange
  • onClose
  • onDestroy
  • onKeyDown
  • onMonthChange
  • onOpen
  • onYearChange
  • onValueUpdate
  • onReady
  • onPreCalendarPosition
  • onDayCreate
  • onParseConfig

You will be able to override this via :events="yourEventsList" prop.

@ankurk91 ankurk91 added this to the 7.0.0 milestone Jan 30, 2018
@ankurk91 ankurk91 self-assigned this Jan 30, 2018
@james-brndwgn
Copy link

james-brndwgn commented Feb 15, 2018

I've just started trying this out in my project and notice that each time a date is selected it emits 45 events. 42 on-day-create, 1 on-value-update, 1 on-change, and 1 input event. Needless to say this seems excessive. The 42 on-day-create events seems like a bug. I suspect it's because Vue is re-rendering the component and flatpickr sees this as a recreation and therefore calls an event for each day in the current calendar view. Perhaps there's a better way to suppress this.

In fact on initial mount I'm seeing 130 events fire for one calendar.

@ankurk91
Copy link
Owner Author

The 42 on-day-create events seems like a bug.

It is not a bug, it is a feature.
These events allow you to customize each day, see how.

@james-brndwgn
Copy link

james-brndwgn commented Feb 15, 2018

These events allow you to customize each day, see how.

Yeah, I read that.. however that's on onCreate event. Though it seems excessive imo, fair enough... however, that should only occur on the initial load of the calendar. These events are firing every time you change the date. To me that sounds like a bug. As in, the plugin should fire 42 on-day-create events when the calendar loads (and I suppose when changing months) but it shouldn't fire the onDayCreate event when selecting a date. I'll try a non Vue implementation and see if the same occurs.

@james-brndwgn
Copy link

Hmm.. you were right that's how the plugin creators have designed it. Seems excessive. https://jsfiddle.net/1ns783ze/5/

@ankurk91
Copy link
Owner Author

closed with v7.0.0

@james-brndwgn
Copy link

@ankurk91 Just upgraded to 7.0.0 and can confirm this works as expected. Thanks for pushing that update 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants