@serkandurusoy Lets take my example above and apply a state management solution per your comment. Lets assume that we have two components postDetail(shows the full details of a post) and postTile (shows just a tile version of a post). Each of these component/template need the functionality to allow the user to edit a post i.e. talk to the editPostDialog to perform this action.
lets provide a state for edit
var editPost = new ReactiveVar(null);
now in order for editPostDialog to react to that state, we will have to add the following code
this.autorun(function(){
this.post = editPost.get()
}
now when edit is complete, editPostDialog has to send the edited post back to its initiator so they can do whatever they need to do with the new temporary state. To accomplish that we need to add another state. …See where this is going.
var editPostDone = new ReactiveVar(null);
Which both postDetail & postTile component/template will have to react to by adding the following code
this.autorun(function(){
this.postedit = editPostDone.get()
}
Now, since both postDetail & postTile depend on the ReactiveVar editPostDone, editing from postDetails will reactively run the above auto run in postTile as well. Sure, we distinguish between the two by matching their post id with the post id from the editPostDone state but thats just one case. They are many inter component/template communication that might have a mechanism to distinguish between which component should be affected by state change.
Applying the same example to say Polymer,
When editing from either postDetail & postTile, the code will look like …
//on edit
self.on_edit_done = function(event/*with data*/){
//do some work here
.....
//release handler
editPostDialog.off('edit-done, self.on_edit_done);
}
var editPostDialog = document.find('editPostDialog');
editPostDialog.post = postToEdit
editPostDialog.on('edit-done',self.on_edit_done)
editPostDialog.show();
Looking on the code above, polymer allow you to interact between the components just like you would between any html control. Direct subscription and un-subscription to events allows us to detach from the control when we have no use for it any more.
I think using Tracker will be possible if its has the ability and easy to start and stop reactivity on a particular state at will. I also don’t like using external states within components for that goes against encapsulation nature of components.