Lime Web Components API Documentation - v6.24.0
    Preparing search index...

    Interface ViewFactoryRegistryBeta

    Registry for view factories

    A view factory is used to create a view from some data, typically a LimeObject but can also be any other data type. Multiple factories can be registered for the same view type, and when that is done the factory returned from ViewFactoryRegistry.getFactory will invoke each one in the order that they were added, using the return value from each factory as input for the next factory in the chain.

    const factory = (
    limeobject: LimeObject,
    scope: ContextScope,
    view?: ListItem
    ): ListItem => {
    return {
    ...view,
    icon: 'dog',
    };
    };
    registry.registerFactory('list', factory);
    const createListItem = registry.getFactory('list');
    const scope = platform.get(PlatformServiceName.ContextRegistry).scope({
    host: this.host,
    });
    const listItem = createListItem(limeobject, scope);
    interface ViewFactoryRegistry {
        getFactory<TView = unknown, TData = unknown>(
            type: string,
        ): ViewFactory<TView, TData>;
        registerFactory<TView = unknown, TData = unknown>(
            type: string,
            factory: ViewFactory<TView, TData>,
        ): void;
    }
    Index

    Methods

    • Beta

      Get a factory for the given view type

      Type Parameters

      • TView = unknown
      • TData = unknown

      Parameters

      • type: string

        the type of view to get a factory for

      Returns ViewFactory<TView, TData>

      a factory for the given view type

    • Beta

      Register a factory for a given view type

      Type Parameters

      • TView = unknown
      • TData = unknown

      Parameters

      • type: string

        the type of view to get a factory for

      • factory: ViewFactory<TView, TData>

        factory function to create a view of the specific type

      Returns void