-
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
Adding region aliases into childEvents hash #2819
Adding region aliases into childEvents hash #2819
Conversation
nice @msiconolfi! I left a comment in #2783. But, i wonder if Also, not sold on the value but I'd defer to the group here. Lastly, if we used the generic More stuff, tests are great. Mind adding some docs |
300aaee
to
f62159a
Compare
I think I'm 👎 on this. While it follows the established pattern, I'm not confident in the current implementation. My concern in general is that we are doing a lot of work for each event a child throws.. and those child events are already pretty noisy. Seems like the @region childEvents could be analyzed before the view is shown one time and then those event hashes are managed separately? I'm not sure exactly the solution, but in general I think we need to find ways to reduce trigger weight and to reduce event noise. |
@paulfalgout i think you're right. We do that for the other aliases |
@paulfalgout I agree the If you think that this might be a viable feature to eventually release, then I can work on a better approach. Could others weigh in on whether adding @region aliases for childEvents is something we would want in the library one day? |
Hmmm.. it may very well be a viable feature.. I personally think Like someday a refactor would be to remove https://github.com/marionettejs/backbone.marionette/pull/2819/files#diff-7f9d7745f16bb572e41cb88f8eaf7734R246 |
ping @msiconolfi hope you have a chance to tackle this :) |
Still working on this. I wanted to review the library as whole to try and see how to best fit it in and provide the cheap lookup. I should have a second implementation in a couple of days. |
Nice. What was your opinion of the library as a whole? Everything is busted? Not so bad :) Also, did you see we landed the new ES6 build and modules yesterday? AKA everything is different :P |
@jasonLaster In general, everything is nicely laid out, I was just trying to get a handle of the differences between I'll take a look at the ES6 build and modules today. But it sounds exciting so far. |
Regarding @paulfalgout comment "Seems like the @region childEvents could be analyzed before the view is shown one time and then those event hashes are managed separately?". This would work fine for when Any ideas of how we could still make this a cheap lookup, at this point it may be too expensive for it to be a useful feature. We could possibly add a |
Should be fine. The childEvents function would be executed on view instantiation and saved to an indtance prop we can access. |
☎️ @msiconolfi! How goes it? |
Still working on it. I'm not in love with my current implementation, but would appreciate any feedback. Here is the basic flow:
I still need to add A couple things I don't like.
|
Definitely going in the right direction. I like bind and unbind w/ listenTo. Mind rebasing. We've been busy :) |
Is this going v3? no milestone on original issue #2783 |
v3.x :-) |
I can pick this up this week, sorry this fell off my plate. I just need to rebase and then re-work the bind/unbind. I should be able to get something up and running this week to review. Thanks for the nudge. |
@msiconolfi no pressure here at all. Thanks for being up to working on it! We might be in the weeds a bit soon with the v3 release candidate. This could certainly land at any point, but take all the time you need 👍 |
|
||
if (_.isFunction(eventHandler) && validRegionEvent) { | ||
regionEvents[regionEventName] = function() { | ||
var args = Array.prototype.slice.call(arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would _.toArray
help shorten this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually since we are using es6 just use spread would be better.
Like so: https://github.com/marionettejs/backbone.marionette/pull/2819/files#r56397920
Is this being subsumed into #3157? |
This is pretty outdated now. For now it seems like the best course is to close this and refer to it if anyone picks up the open issue. |
Preliminary enhancement for supporting region aliases in the
View.childEvents
hash, as requested in Issue 2763.AbstractView
and intoView
object, and simply callinglayoutView.triggerChildEvents(eventName, this, args);
from insideAbstractView._triggerEventOnParentLayout
; to me this seems to separate the logic a little better, and also provides a hook for subclasses to override if needed.childEvents
hash, non-region aliases should behave the same as in earlier releases.