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

    Interface PollerFactoryBeta

    Factory for creating pollers.

    const poller = factory.create(
    async () => fetchDataFromAPI(),
    60000 // Polling every 1 minute
    );

    const unsubscribe = poller.subscribe((data) => {
    console.log('Received data:', data);
    });

    unsubscribe();
    interface PollerFactory {
        create<T>(callback: () => Promise<T>, intervalMs: number): Poller<T>;
        createIdlePoller<T>(
            callback: () => Promise<T>,
            intervalMs: number,
            idleState?: IdleState,
        ): Poller<T>;
    }
    Index

    Methods

    • Beta

      Creates a generic poller

      Type Parameters

      • T

      Parameters

      • callback: () => Promise<T>

        An asynchronous function that will be executed periodically by the poller.

      • intervalMs: number

        The interval, in milliseconds, at which the callback should be executed.

      Returns Poller<T>

      the poller

    • Beta

      Creates a poller that executes its callback based on the users idle status

      Type Parameters

      • T

      Parameters

      • callback: () => Promise<T>

        An asynchronous function that will be executed periodically by the poller based on the users idle status.

      • intervalMs: number

        The interval, in milliseconds, at which the callback should be executed.

      • OptionalidleState: IdleState

        The idle state when the poller is active. When set to active, the poller will only execute while the user is actively using the application. When set to idle, the poller will only execute while the user is idle. Default value is active.

      Returns Poller<T>

      the poller