Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Best practice for passing references to a can.Component instance

$
0
0
Tom,
  You're right, but I might say it's the beautiful thing about the observer pattern.  You interact with your observables/data.

Steven,
  Have you checked out the tabs example from can.Component's docs page?  I'd look through that code.  I might not do it the way Tom suggested and have a method I can call on my scope like "addNotification" like:

notifications: [],
addNotification: function(notification){
  this.attr('notifications').push(notifications)
}



which can be called by other components like:

$("notifications").scope().addNotification( notification )



Viewing all articles
Browse latest Browse all 3491

Trending Articles