Options
All
  • Public
  • Public/Protected
  • All
Menu

Module src/core/promise/sync/helpers

Index

Functions

Functions

  • memoize<T>(keyOrPromise: unknown, promise?: PromiseLikeP<T>): Promise<T>
  • Memorizes the specified promise and converts it to a synchronous promise. It means that after the first resolution, the promised result will be cached, and the method returns the synchronous version of a promise.

    example
    memoize(nextTick());
    memoize('core/url/concat', () => import('core/url/concat'));

    Type parameters

    • T = unknown

    Parameters

    • keyOrPromise: unknown

      promise or a promise factory to cache, or a key to cache the promise

    • Optional promise: PromiseLikeP<T>

      promise or a promise factory to cache (if the first argument is a key)

    Returns Promise<T>