ixfx
    Preparing search index...

    Function iterator

    • Creates a readable reactive based on a (async)generator or iterator

      // Generator a random value every 5 seconds
      const valuesOverTime = Flow.interval(() => Math.random(), 5000);
      // Wrap the generator
      const r = Rx.From.iterator(time);
      // Get notified when there is a new value
      r.onValue(v => {
      console.log(v);
      });

      Awaiting values could potentially hang code. Thus there is a readTimeout, the maximum time to wait for a value from the generator. Default: 5 minutes. If signal is given, this will also cancel waiting for the value.

      Type Parameters

      • V

      Parameters

      • source:
            | IterableIterator<V, any, any>
            | V[]
            | AsyncIterableIterator<V, any, any>
            | Generator<V, any, any>
            | AsyncGenerator<V, any, any>
      • options: Partial<GeneratorOptions> = {}

      Returns Reactive<V>