PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: trilec on May 09, 2008, 10:32:50



Title: Proxy onRegister Notification - execution order
Post by: trilec on May 09, 2008, 10:32:50
Hi All, was doing a few tests (multicore) and noticed some interesting behavior which is related to execution order.

The goal seemed fairly simple, A proxy sends  ApplicationFacade.IM_INITIALIZED, from within its onRegister() but as it appears MODELS done first then VIEWS thus  no "MY DATA IS INITIALIZED" Notification can't be sent from a proxy to a mediator at this startup stage, this can however can be done from a Mediator which would request "INITIALIZE yourself" then the proxy would respond IM_INITIALIZED

notifyObservers: ImInitialized
notifyObservers: StartupInitialized
notifyObservers: Startup

It almost seems like you need a Notification registered in a proxy that gets sent when ALL MODEL/VIEW are registered??
is there a framework suggestion (besides the Mediator call INITIALIZE proxy to get Notification  out)

T


Title: Re: Proxy onRegister Notification - execution order
Post by: puremvc on May 13, 2008, 12:06:05
The idea is to have the model initialized before the view is initialized, since the view will want to access the model when it starts up.

So sending a notification out of a Proxy's onRegister would only be useful if there is a command listening for it or if the Proxy is being crerated and registered dynamically at runtime and a mediator wants to know about it at that stage.

You probably want to defer any service calls that you might've otherwise made in the Proxy constructor until onRegister time though. This way you're sure that if the Proxy needs to send notifications on result or fault it will be registered at that time.

-=Cliff>