transferum
    Preparing search index...

    Function createIdlePollingTransfer

    • Creates an IdlePollingTransfer — a reactive channel with fallback polling on idle.

      If no data has been received via push() for longer than timeout ms, periodic polling of the fetcher starts with the given interval. When new data arrives via push(), polling stops and the idle timer resets.

      Capabilities: Pushable, Pullable, Subscribable, Triggerable, Gate

      Type Parameters

      • T

      Parameters

      Returns ExplicitTransfer<T, T>

      const channel = createIdlePollingTransfer<number>({
      fetcher: () => fetchLatest(),
      timeout: 5000,
      interval: 1000,
      activated: true
      });
      channel.subscribe(x => console.log(x));
      channel.push(42); // notifies subscribers, resets idle timer
      // after 5 seconds without push, polling starts every 1 second