-
Notifications
You must be signed in to change notification settings - Fork 21
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
Some nice features to add #26
Comments
trigger allows you to call a parent template event |
Interesting. Otherwise things are easier to discuss though a pull request. And also iterate on that. I think that it would be maybe more useful to extend For trigger I do not have an opinion. Can you describe the use case? |
That would be a nice high order function! Trigger is inspired to make UI components. For example, you may have nav component and you want to pass its nav events to the responsible template. I think it would be far more useful if it could call events not just on its parents but any template. Not sure how to do that though... Im basically just bastardizing the Template.events to work as a generalized event emitter as well... |
If we add EDIT: Not sure whether the "bubbling" in your code is necessary. Guess I'd have to see what the various exact use cases are. |
that makes sense actually. We can then invert the logic a bit. As to @mitar's suggestion, we could pass a filtering function to findAncestor to see if the template has the event and then trigger it.
|
I think it would be very convenient if Template events could be treated as you might an event emitter that automatically unsubscribe when they're destroyed. An example would be if you had two sibling templates -- content and menu. Suppose menu is a swappable menu. It would be great if Menu can communicate to Content when its opened and it would be great if the content could communicate to the menu that it has been tapped (so close the menu). This is all part of some brainstorming I've been doing into making components with Blaze. |
Cool, I have been interested in components from the autoform perspective. The componentization already within autoform works pretty well, but is specific to that usage. End goal would be to support whatever MDG or the community settles on for components. |
Oh, and you can submit a PR for these things, or one of us will add them when we have time. |
Hey there, I wrote some convenient functions that you may like to include in this package. They don't use your internal functions so you would probably want to do that.
The text was updated successfully, but these errors were encountered: