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

Form is passed as the final argument to event handlers #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vladbalan
Copy link
Contributor

The form that triggered an event is now passed as the last argument. This closes #22

@cwohlman
Copy link
Contributor

@vladbalan Looks like we didn't fully think through this api, the reason that our test fails is because we were assuming that the last argument passed to a triggered event was the data for our event, and that the other arguments were syntactic sugar (e.g. the doc), but when we added the form argument we placed it on the end, which means it is treated as the most significant argument.

We should either:

  1. Replace doc with form, so which would require users of our package to call form.doc()
  2. Pass both as arguments which means long signatures like this: documentInvalid: function (e, tmpl, form, doc, errors)

It bothers me to have 5 arguments to an event function, but I think that would be the best solution from the stand point of someone using it, but not perfect. Suggestions?

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

Successfully merging this pull request may close these issues.

The form which triggered an event should be passed as the final argument to event handlers
2 participants