Function timeout

  • Generic timeout task

    Usefull for creating delays in task chains or implementing limiting tasks

    Parameters

    • delay: number

      duration in ms after that the task resolves to void

    Returns Task<void>

    task resolving to void (undefined) after specified delay

    Example

    const delayedValueTask = <T>(value: T, delay: number) => Task.timeout(delay).map(() => value);
    // ... //
    const value = yield* delayedValueTask(42, 1000).generator();

    console.log("It's past 1 second and here's a value:", value)

Generated using TypeDoc