-
Notifications
You must be signed in to change notification settings - Fork 397
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
Fire() event don't pass event
argument.
#1235
Comments
@martypdx I think the goal here is to have a DOM-triggered event and a manually fired (from script, not template) event receive the same arguments. Having to check @Iverson There's not really anything meaningful that ractive could supply for an event object for script-fired events. In practice, manually fired events and DOM-fired events don't usually overlap much. My solution thus far has been to simply pass an empty object or check |
@martypdx thanks, but |
I don't think the current model is conducive to that. As you point out the proxy-event has an auto included This is why I like, even though it's a bit more syntax, requiring the controller method // developer decides to include event:
<button on-click='fire:select, {{event}}, {{i}}'>
// or not:
<button on-click='fire:select, {{i}}'> this.fire('select', event, index)
// or
this.fire('select', index)
Yes, there are some features with proxy-events that have not been carried forward to method calls. Auto event subscription is another one. Checkout out the discussion on other thread and weigh in with your opinion. |
|
on-click="selectTab:{{i}}"
will fireselectTab
event with two arguments:event
andi
, butractive.fire('selectTab', i)
fire same event only with single argumenti
. This is architecture bug.Example - http://jsfiddle.net/5g3d912e/
Also if i pass method call like
<a href="#" on-click="myMethod(i)">Link</a>
thenmyMethod()
will be called withoutevent
argument and it will be impossible callpreventDefault()
as result in my casewindow.location.hash
will be changed. I think it makes sense to add option for passingevent
argument to method call.The text was updated successfully, but these errors were encountered: