You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to propose a small change in our event naming convention.
Right now, as it's stated in #15 we decided to use lowerCamelCase for event names, but I think it would be much better if we had a simple way to also namespace them using a colon, because:
Namespacing events would help us determine what module/feature/operation triggers them.
Example: transactionStart, transactionEnd vs transaction:starttransaction:end - in the second case you can clearly tell what we're listening to.
Having namespaced events along with a way to listen to the entire namespace, e.g. change:* would allow us to catch all changes in a model, besides we wouldn't have to trigger another change event after that. We may also agree that a namespaced event will trigger a namespace event, something like this:
t.trigger('transaction:start',args);// it would automatically trigger the following:t.trigger('transaction','start',args);
What do you think?
The text was updated successfully, but these errors were encountered:
I like the idea in general, although I don't have a strong opinion on the implementation. The one with ability to listen to change:* does not require firing another event (change), so it may be more optimal in this sense, but at the same time implementing listening to change:* may not be optimal. I would be also curious about listener priorities if listening to change:* was possible (my guess is - general listeners are executed after specific listeners). And finally - if change:foo was stopped by its listener, will change/change:* listeners be executed?
We implemented namespacing and even the ability to listen to foo when someone fired foo:bar:bom. It proved to be useful in cases like firing conversion of element:p. You can listen on a specific element conversion (element:p) or conversion of any element.
I'd like to propose a small change in our event naming convention.
Right now, as it's stated in #15 we decided to use lowerCamelCase for event names, but I think it would be much better if we had a simple way to also namespace them using a colon, because:
Namespacing events would help us determine what module/feature/operation triggers them.
Example:
transactionStart
,transactionEnd
vstransaction:start
transaction:end
- in the second case you can clearly tell what we're listening to.Having namespaced events along with a way to listen to the entire namespace, e.g.
change:*
would allow us to catch all changes in a model, besides we wouldn't have to trigger anotherchange
event after that. We may also agree that a namespaced event will trigger a namespace event, something like this:What do you think?
The text was updated successfully, but these errors were encountered: