ixfx

    Function asCallback

    • Calls callback whenever the chain/generator produces a value.

      When using asCallback, call it with await to let generator run its course before continuing:

      await asCallback(tick({ interval:1000, loops:5 }), x => {
      // Gets called 5 times, with 1000ms interval
      });
      console.log(`Hi`); // Prints after 5 seconds

      Or if you skip the await, code continues and callback will still run:

      asCallback(tick({ interval: 1000, loops: 5}), x => {
      // Gets called 5 times, with 1000ms interval
      });
      console.log(`Hi`); // Prints immediately

      Type Parameters

      • V

      Parameters

      Returns Promise<void>

    MMNEPVFCICPMFPCPTTAAATR