Function createIdleResolvedPromise

Returns an idle Promise instance that is already resolved with the given value. If the value passed is a promise then that promise is returned instead of creating a new asynchronous promise instance. If a new instance is returned then any chained operations will execute asynchronously using the requestIdleCallback API (if available) with the optional provided timeout value to schedule when the chained items will be executed. (eg. then(); finally()).

  • Type Parameters

    • T

    Parameters

    • value: T

      The value to be used by this Promise. Can also be a Promise or a thenable to resolve.

    • Optionaltimeout: number

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

    Returns IPromise<T>