Base interface that all Lime Web Components must implement.

This interface ensures that every component has access to the LimeWebComponentPlatform service container and understands its LimeWebComponentContext within the application. In Stencil components, these are injected as properties using the @Prop decorator.

Example

// Access services through platform
const repo = platform.get(PlatformServiceName.LimeObjectRepository);

// Use context to understand where component is running
console.log(`Running for ${context.limetype} with id ${context.id}`);

// Load the current object if context has an ID
if (context.id) {
const limeObject = await repo.loadObject(context.limetype, context.id);
}

Example

// Check if running in a nested context
if (context.parent) {
console.log(`Parent: ${context.parent.limetype}/${context.parent.id}`);
console.log(`Current: ${context.limetype}`);
}

Remarks

The platform and context properties are fundamental to component operation:

  • platform provides access to all services (repositories, HTTP, command bus, etc.)
  • context describes where the component is running (which limetype, which record)

Hierarchy

Properties

Properties

The context describing where this component is running.

The context provides information about the current limetype and record ID (if viewing/editing a specific record). Components can use this to load relevant data and understand their operating environment.

Example

// Load current record if we have an ID
if (context.id) {
const repo = platform.get(PlatformServiceName.LimeObjectRepository);
const object = await repo.loadObject(context.limetype, context.id);
}

Reference to the platform service container.

Use this to access all platform services like repositories, HTTP client, command bus, navigator, and more. The platform instance is shared across all components in the same application context.

Example

const http = platform.get(PlatformServiceName.Http);
const commandBus = platform.get(PlatformServiceName.CommandBus);