@vgerbot/async
    Preparing search index...

    Function forever

    • Repeatedly executes a task forever until cancelled. This is an infinite loop that only stops via cancellation.

      Parameters

      • task: AsyncTask<void>

        The async task to execute repeatedly.

      • Optionaloptions: CancellableOptions<never>

        Cancellable configuration options.

      Returns CancellableHandle<never>

      A cancellable handle that never resolves (only rejects on cancellation).

      const handle = forever(async (token) => {
      await token.sleep(1000);
      console.log("tick");
      });

      // Stop after 5 seconds
      setTimeout(() => handle.cancel(), 5000);