| Summary: | Function to get multiple services | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | John Arthorne <john.arthorne> |
| Component: | Client | Assignee: | Simon Kaegi <simon_kaegi> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | bokowski, simon_kaegi |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
This pattern is so common, I wonder if we should be using a DeferredList or something along those lines more regularly instead of putting this in our implementation. I wouldn't add to much convenience around this. Ideally, all the "getting a service" calls should be in a top-level JavaScript file that gets the services needed on a particular page, and just passes the service instance instead of the service registry. (In reply to comment #2) > I wouldn't add to much convenience around this. Ideally, all the "getting a > service" calls should be in a top-level JavaScript file that gets the services > needed on a particular page, and just passes the service instance instead of > the service registry. That sounds like exactly the kind of scenario where you need a "get several" function. Say a given page needs ten services. The "glue code" script that gathers all those services is going to be ugly without some kind of helper. Currently our "glue code" scripts are bypassing the service registry and manually instantiating all the services, so we don't see the problem yet. Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see: https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html |
We typically have a coding pattern like this: serviceReg.getService("SomeService").then(function(service) { service.doSomething(); }); If you need two services you need something like: serviceReg.getService("SomeService").then(function(service) { serviceReg.getService("AnotherService").then(function(another) { service.doSomethingWith(another); }); }); It would be nice if the service registry had a convenience for doing something that requires multiple services at once: serviceReg.getServices("SomeService", "AnotherService").then(function(service, another) { service.doSomethingWith(another); });