Lime Web Components API Documentation - v7.4.0
    Preparing search index...

    Interface ContextMetadata<K>Beta

    Describes a context entry, its id, a label, and an optional description. Supplied at bootstrap when an entry is registered.

    The generic parameter ties id to a known key. So if you pass { id: 'user' }, the registration's fallback must return a User. Passing a different type is a compile error.

    Example: Register the built-in user entry

    import {
    ContextMetadata,
    PlatformServiceName,
    } from '@limetech/lime-web-components';

    const userContext: ContextMetadata<'user'> = {
    id: 'user',
    label: 'Current user',
    description: 'The user currently authenticated in the session.',
    };

    const registry = platform.get(PlatformServiceName.ContextRegistry);
    const application = platform.get(PlatformServiceName.Application);

    // The `'user'` id pins the fallback's return type to User, so returning
    // anything else would not compile.
    registry.register(userContext, () => application.getCurrentUser());
    interface ContextMetadata<K extends keyof ContextMap = keyof ContextMap> {
        description?: string;
        id: K;
        label: string;
    }

    Type Parameters

    Index

    Properties

    Properties

    description?: string

    Longer description for tooltips or help text. Optional.

    id: K

    The context id. Must be a key of ContextMap.

    Plugin-added entries should use namespaced ids (mypkg.foo, pluginx.bar) so two plugins can't accidentally claim the same name. The built-in keys (user, limeobject, action, coworker, limeobjectFormData) are first-party and exempt from this convention.

    label: string

    Human-readable label. Useful for consumers that enumerate registered entries.