????
+--Dispatcher
+--com.bumpslide.services.ServiceProxySingle point of access for all services in an application
This class is meant to be extended once for each application. Services can be added automagically using the addServiceMethod function, but it is better to create actual stub methods in you service proxy implementation so that you can make use of proper code-hinting while developing the client code in view classes.
The service proxy enqueues all service requests and performs some smart checking to determine whether or not a service really needs to be called. Stale service calls (calls to services already in the queue, but with different params) can be automatically removed to avoid unnecessary server calls.
Example Usage:
var service = ServiceProxy.getInstance(); // services normally added in subclass iniServices method... service.addServiceMethod( "loadMyData", MyDataService ); // in client we then listen nad load service.addEventListener("onServiceResult_loadMyData", this); dataLoader.loadMyData(2027477); function onServiceResult_loadMyData( myData ) { traceObj( myData ); }
static public function getInstance()static method, used to make 1 instance (singleton) this must be replicated in the subclass implementation
public function getCurrentRequest():ServiceRequestReturns service request currently being processed