Function createNativePromise

  • Creates a Promise instance that when resolved or rejected will execute it's pending chained operations using the available native Promise implementation. If runtime does not support native Promise class (or no polyfill is available) this function will fallback to using createAsyncPromise which will resolve them asynchronously using the optional provided timeout value to schedule when the chained items will be executed.

    Type Parameters

    • T

    Parameters

    • executor: PromiseExecutor<T>

      The function to be executed during the creation of the promise. Any errors thrown in the executor will cause the promise to be rejected. The return value of the executor is always ignored

    • Optionaltimeout: number

      Optional timeout to wait before processing the items, defaults to zero.

    Returns IPromise<T>