See the
LoadupMonitorProxy class for the primary documentation on the
Loadup utility. See the demo app called LoadupAsOrdered as an example of
how
LoadupResourceProxy can be used. In particular, see LoadResourcesCommand in
that app.
It is assumed that the client application has a puremvc-compliant proxy object for each
loadup resource, each uniquely named. Those objects must implement ILoadupProxy.
In addition, the app must instantiate a LoadupResourceProxy object for
each loadup resource, with a reference to the ILoadupProxy object being passed to
the constructor. These LoadupResourceProxy objects exist only for the purposes of
the utility. How they are named is of no interest to the utility. Each of these objects should be
registered with the puremvc model i.e. facade.registerProxy; this is absolutely required when the
utility is used with puremvc multicore.
To specify dependencies between resources, use the requires property. For example,
if we have 3 resources r1,r2,r3, and r3 requires that r1 and r2 must be loaded first,
then we state r3.requires = [r1, r2];.
Assignment to the requires property is ignored if it occurs
after a certain stage in the loading process as managed by LoadupMonitorProxy (the monitor), as follows
-
after invocation of the monitor's loadResources() method, for those resources already listed
- after a resource is added to the monitor's list using addResource() or addResources(), when that occurs
after invocation of loadResources().
Each resource adopts a Retry Policy, to govern retries to load resources when a load attempt fails,
and to govern application of timeouts on load attempts. The utility provides a particular RetryPolicy
class that the client app can use, but the app could also implement its own in accordance with the
IRetryPolicy interface. However, regardless of retry policy, there is a built-in assumption that
automatic retries do not occur after timeout.
Use of the retryPolicy property is as follows
-
provides the client app with a means to set a retry policy specific to this resource
- the initial value is null; this means use the defaultRetryPolicy from LoadupMonitorProxy
- the app can set the defaultRetryPolicy property on LoadupMonitorProxy
- the app can set the retryPolicy property on each resource, but should only bother to do
so if it differs from defaultRetryPolicy
- the app can set this before invoking LoadupMonitorProxy.loadResources(), and can also set this later,
in the case where loading finishes incomplete, if a change of policy is required, before invoking
LoadupMonitorProxy.tryToCompleteLoadResources
- another way to effect a change of policy, where the same input parameters apply to all policy
instances, is to use the reConfigureAllRetryPolicies() method on LoadupMonitorProxy.
Adapted from original code of Daniele Ugoletti in his
ApplicationSkeleton_v1.3 demo, Nov 2007, posted to the puremvc forums.
Also from code of Joel Caballero, Feb 2008, posted to the forums.
appResourceProxy:ILoadupProxy [read-only]
Implementation
public function get appResourceProxy():ILoadupProxy
monitor:LoadupMonitorProxy [read-write]
Implementation
public function get monitor():LoadupMonitorProxy
public function set monitor(value:LoadupMonitorProxy):void
requires:Array [read-write]Implementation
public function get requires():Array
public function set requires(value:Array):void
retryPolicy:IRetryPolicy [read-write]
Implementation
public function get retryPolicy():IRetryPolicy
public function set retryPolicy(value:IRetryPolicy):void
public function LoadupResourceProxy(proxyName:String, appResourceProxy:ILoadupProxy)Parameters
public function appResourceProxyName():String
Returns
public function closeRequires():void
public function getLoadingStartTime():Number
Public getter, to facilitate testing.
Returns
public function isFailed():Boolean
Returns
public function isLoaded():Boolean
Returns
public function isLoading():Boolean
Returns
public function isOkToLoad():Boolean
Returns
public function isOkToReset():Boolean
Returns
public function isOkToRetry():Boolean
Returns
public function isOkToSetFailed():Boolean
Returns
public function isOkToSetLoaded():Boolean
Returns
public function isTimedOut():Boolean
Returns
public function reset():void
public function setStatusToFailed():void
public function setStatusToLoaded():void
public function setStatusToLoading():void
public function setStatusToTimedOut():void
public function startLoad():void
public function startRetry():void