puremvc
|
|
« Reply #1 on: December 16, 2008, 07:09:03 » |
|
The StateMachine utility is really for implementing application-wide state management.
For handling added children, I suggest starting out looking at the Slacker demo.
The chief difference between that demo and what you are after is that the deferred instantiation is in the form of viewstack children that are created late, but never removed.
You would want a similar setup where a mediator will listen to either the app or custom component that will have children added to it when its state changes. Rater than listen for creationComplete events from the children, you'll listen for childAdded event (I believe; I'm using a limited wap browser so I can't doublecheck the API). Hook the added child to a new instance of the correct mediator. Have that mediator place a 'removed' eventlistener on the child. Whenever the child is removed from the view, its mediator should null its viewComponent property and unregister itself.
-=Cliff>
|