Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Proxy onRegister Notification - execution order  (Read 6760 times)
trilec
Sr. Member
****
Posts: 52



View Profile WWW Email
« 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
« Last Edit: May 09, 2008, 04:51:28 by trilec » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
Logged
Pages: [1]
Print