ixfx
    Preparing search index...

    Function elapsedInfinity

    • Returns a function that reports an 'infinite' elapsed time. this can be useful as an initialiser for elapsedSince et al.

      // Init clicked to be an infinite time
      let clicked = elapsedInfinity();

      document.addEventListener('click', () => {
      // Now that click has happened, we can assign it properly
      clicked = elapsedSince();
      });

      Use isInfiniteSince to check if a function is of type infinity:

      let clicked = elapsedInfinity();

      document.addEventListener('click', () => {
      if (isInfiniteSince(clicked)) {
      console.log(`First time clicked!`);
      }
      clicked = elapsedSince();
      });

      Returns Since

      A function that returns Number.POSITIVE_INFINITY when called.