Services Overview
In VertiGIS Studio Web, services represent a shared application-wide concern that needs to be accessed by many components or other services. There is only one instance of each service in the application. Interactions with services usually happen through the commands and operations they implement, but services can also be directly injected into other services and component models.
Services are created at startup if they are registered with the loadOnStartup
option, otherwise, they will be created when one of their commands and operations is run or they are directly injected into another service or component model.
Services can be optionally configured by extending the ConfigurableServiceBase
class.
import { ServiceBase } from "@vertigis/web/services";
import { command, operation } from "@vertigis/web/messaging";
export default class ExampleService extends ServiceBase {
someSharedGlobalState: Map<string,string>;
@command("example-service.some-command")
protected _someCommand(args: any) {
...
}
@operation("example-service.some-operation")
protected async _someOperation(){
...
return result;
}
}
Next Steps
Create a Service
Learn how to create a basic service
Check out the Service Reference
Take a deep dive into services in the VertiGIS Studio Web SDK