-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
triggerMethod is not consistent between views & behaviors #2650
Comments
I've always considered the return an odd functionality for |
Quoting myself
|
Or Array of [view returned value, {behaviorName: behavior returned value, ...}] |
so would this then be |
Why not... It's just some naive solution. My point being that triggerMethod is not consistent. Another solution would be to make it never return an object. |
Yep. I'm not really arguing against this or anything. I agree it is not consistent. I'm just not sure of a clear consistent fix. Anything I imagine would be a breaking change as well. |
That's right. |
This bit me a few days ago. I had to make the the view implement the method in the Behavior. E.g.
And then use it in the view.
Any advance on this? I have seen the current implementation and I see that there is a return value being saved if the view has a handler method and then it proceeds to call the view behavior and parent views. Why not check if the view return is undefined and then try to execute the behavior/parent view and get a return value? Problem is with different behaviors implementing the same method. |
So, I want this feature too. I'm not harping about the inconsistent behavior coming out of This one, I think, is very tricky. For one,
Where, both So, while I started this post thinking I'd put some thought into building up |
I do agree with the fact that triggerMethod shouldn't return any value at all. That being said, a simple workaround would be : view.triggerMethod('some:trigger', obj); And then in any view or behavior : onSomeTrigger: function(obj) {
obj.return_value = 'Hello world !'; // Or make it an array if you expect multiple return values
} It's kind of hacky but it does the job |
How this will evolve in v3 @paulfalgout? |
this isn't on the v3 roadmap |
So for now in next |
I don't think the behavior or |
triggerMethod
called from a view with the matching method in the same view return the value returned by the method buttriggerMethod
called from a view with the matching method in a behavior of that view does not return the value returned by the method.Would be nice to return all values in an Array of all methods called if many.
The text was updated successfully, but these errors were encountered: