ixfx
    Preparing search index...

    Function ofTotal

    • Returns a function that returns the percentage of timer completion. Starts when return function is first invoked.

      import * as Flow from "https://unpkg.com/ixfx/dist/flow.js"
      const timer = Flow.ofTotal(1000);

      // Call timer() to find out the completion
      timer(); // Returns 0..1

      Note that timer can exceed 1 (100%). To cap it:

      Flow.ofTotal(1000, { clampValue: true });
      

      Takes an Interval for more expressive time:

      const timer = Flow.ofTotal({ mins: 4 });
      

      Is a simple wrapper around relative.

      Parameters

      • duration: Interval
      • opts: { clampValue?: boolean; wrapValue?: boolean } = {}

      Returns () => number