• Runs given callback async.

    Type Parameters

    • Args extends any[]
    • Result

    Parameters

    • callback: ((...args) => Result | PromiseLike<Result>)

      a function to execute async

    • delay: number

      the delay in msec

    • Rest ...args: Args

      the arguments pushed to the callback during execution.

    Returns CancelablePromise<Result>

    the execution promise

    Example

    import async from "apprt-core/async";
    // a sum function
    let sum = (x,y)=> x + y;
    // execute 3+4, 200msec later
    async(sum,200,3,4)
    // result === 7
    .then(result => console.log(result));
  • Same as the first overload, but without a delay.

    Type Parameters

    • Args extends any[]
    • Result

    Parameters

    Returns CancelablePromise<Result>

Generated using TypeDoc