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

    Interface SelectLimeObjectsOptions

    Config for the SelectLimeObjects state decorator

    interface SelectLimeObjectsOptions {
        filter?: ((state: any) => boolean)[];
        getLimetype?: (component: LimeWebComponent) => string;
        id?: number;
        limetype?: string;
        map?: ((state: any) => any)[];
    }

    Hierarchy (View Summary)

    Index

    Properties

    filter?: ((state: any) => boolean)[]

    List of predicate functions that must all return true for updates to be emitted.

    Filters are evaluated after map transformations. If any filter returns false, the callback is not invoked for that state change. Useful for preventing unnecessary updates. Functions are bound to the web component instance.

    import { StateOptions } from '@limetech/lime-web-components';

    const options: StateOptions = {
    filter: [
    (state) => state !== null, // Ignore null states
    (state) => state.isReady, // Only when ready
    (state) => state.items.length > 0, // Only when it has items
    ],
    };
    getLimetype?: (component: LimeWebComponent) => string

    A function to get the limetype

    id?: number

    Id of the limeobject

    limetype?: string

    LimeType of the object

    map?: ((state: any) => any)[]

    List of transformation functions applied sequentially to the state.

    Each function receives the output of the previous function (or the raw state for the first function). Use this to extract, transform, or compute derived values from the state. Functions are bound to the web component instance.

    import { StateOptions } from '@limetech/lime-web-components';

    type Order = { pending: boolean };

    // The callback receives the output of the last function, so here: the count of
    // pending orders.
    const options: StateOptions = {
    map: [
    (state) => state.orders, // Extract orders
    (orders: Order[]) => orders.filter((order) => order.pending), // Pending only
    (pending: Order[]) => pending.length, // Get count
    ],
    };