The type of Lime CRM client currently running. Use this to conditionally enable features based on the client environment.
Get a service from the platform container.
Services are accessed through the PlatformServiceName enum, which can be extended
by third-party modules using module augmentation.
The requested service instance
const http = platform.get(PlatformServiceName.Http);
const repository = platform.get(PlatformServiceName.LimeObjectRepository);
The name of the service to retrieve
Beta
Check if a service is currently registered on the platform.
Useful for optional dependencies or checking service availability.
true if the service is registered, false otherwise
if (platform.has(PlatformServiceName.Analytics)) {
const tracker = platform.get(PlatformServiceName.Analytics);
tracker.track('event');
}
The name of the service to check
Check if a feature is enabled in the current environment.
Feature switches allow gradual rollout of new functionality and environment-specific behavior. Features can be enabled/disabled at the application, user, or system level.
true if the feature is enabled, false otherwise
// Use feature switches for gradual rollout
if (platform.isFeatureEnabled('advancedSearch')) {
return new AdvancedSearchComponent();
} else {
return new BasicSearchComponent();
}
Name of the feature switch to check
Register a service on the platform for use throughout the application.
Service names are typically defined in the PlatformServiceName enum through module
augmentation. This ensures type safety and prevents naming conflicts.
const SERVICE_NAME = 'myPlugin.cache';
PlatformServiceName.MyCache = SERVICE_NAME;
declare module '@limetech/lime-web-components' {
interface PlatformServiceNameType {
MyCache: typeof SERVICE_NAME;
}
interface LimeWebComponentPlatform {
get(name: PlatformServiceNameType['MyCache']): CacheService;
}
}
// Register the service
platform.register(PlatformServiceName.MyCache, new CacheService());
The name to register the service under
The service instance to register
Service container for the Lime CRM platform that provides access to all platform services.
The platform acts as a service locator for accessing repositories, the command bus, HTTP client, and other services throughout the application. It is used by web components (injected via Stencil's
@Propdecorator), command handlers, and other parts of the system.The platform type indicates which Lime CRM client is hosting the component:
LimeCRMWebClient: Standard web clientLimeCRMDesktopClient: Desktop application clientLimeCRMWebAdminClient: Administrative web interfaceExample
Example