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
When bind for notifications.users and sets {notifications: {users: 10}} event will be triggered on notifications and new value is {users:10}. But when removing notifications.users or sets it again it trigger event correctly with value 10
Fiddle there http://jsfiddle.net/EJBqw/
Example with bind changehttp://jsfiddle.net/EJBqw/1/
The text was updated successfully, but these errors were encountered:
triggers a notifications.users event at all. I would assume it would only trigger a notification event. It seems like it was, but being called notifications.users.
The problem is that jQuery's event system will dispatch a "one" event to listeners "one" and "one.two".
We use this functionality in a few places (for observe's bubbling), but not enough so we need it.
We can either ...
Use our own trigger that does not do this and
remove where we depend on this behavior
Faster dispatching
slightly bigger download
might not work perfectly with jQuery's event system. Say a component
triggers events on an object, can we listen to them. We might be able to
get around this by having an extra param on can.bind that says only match
the full event name. This param would be used by Observe's bind.
Wrap all observe binds in some magic that doesn't call the original callback
Finally I had time to understand this a little bit more.
Solutions like another function or extra param are pretty obvious, but API will be complicated. Now there is bind and delegate and sometimes i am confused :) And secod problem i see in using it inside a control "{observer} one.two" how to tell Can there what bind to use.
When bind for
notifications.users
and sets{notifications: {users: 10}}
event will be triggered onnotifications
and new value is{users:10}
. But when removingnotifications.users
or sets it again it trigger event correctly with value10
Fiddle there http://jsfiddle.net/EJBqw/
Example with bind
change
http://jsfiddle.net/EJBqw/1/The text was updated successfully, but these errors were encountered: