Greetings, everyone!
I just finished reading through the docs (hopefully I understood most of them) and started to really use puremvc in my app. There is a situation that the same view component will have multiple instances at the same time and thus multiple instances of the same mediator/proxy. To give you an concrete example, I have a Business explorer, where you can search for businesses and result will be displayed as a list; when user selects a business in the list, a new tab will opened to display the details of this business. So you could end up with multiple tabs open at the same time to display multiple business details. I will have the following classes:
BusinessView - view component that displays business detail
BusinessViewMediator - mediator for BusinessView
BusinessDetailProxy - proxy that loads/updates business detail
Here are the questions I can think of for now:
- How should I name each of the instances when registering them?
- When instantiating these instances, I am thinking to use a command that will create an instance of the mediator and then create the corresponding instance of the proxy, is this the right way to instantiate them?
- To keep the link between corresponding mediator and proxy, do I need to store reference to each other in them?
- When BusinessDetailProxy sends a notification, how do I make sure that only the corresponding BusinessViewMediator instance act upon it?
Thanks in advance.