public function getServices(context:IBundleContext, ... serviceClasses):com.adobe.gravity.utility.async:IToken
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Experience Services - Client Component Framework 10 |
Runtimeversies: | AIR 1.1, Flash Player 9 |
Retrieve a set of services at once.
The caller is responsible for releasing all the services thus obtained.
If you will be using the services over an extended period of time rather than just over the course of an asynchronous function call, it would generally be more efficient and less error-prone to use ServiceTracker objects.
The getServices helper function is intended for use with infrequently called asynchronous APIs.
For example, to retrieve both the IProgressService and the ILocalizedMessageService:
var token:IToken = getServices(BundleContext.currentContext, IProgressService, ILocalizedMessageService);
token.addSuccessHandler(doWork);
token.addFaultHandler(errorHandler);
The doWork function must take an array as the first parameter and for each service class specified in the getServices call, an object of the corresponding type.
For the above example this would mean
private function doWork(serviceReferences:Array, progressService:IProgressService, localizedMessageService:ILocalizedMessageService):void
{
// do work using progressService and localizedMessageService
// release the references acquired with getServices
unget(BundleContext.currentContext, serviceReferences);
}
Parameters
| context:IBundleContext — The bundle context with which to acquire the services.
|
|
| ... serviceClasses — The service classes to be acquired.
|
Geretourneerde waarde