Function defineSinglePromiseFn

  • defineSinglePromiseFn ensures that the provided function can only be called once at a time. If the function is invoked while it's still executing, it returns the same promise, avoiding multiple calls.

    Parameters

    • fn: Fn

      The function to be wrapped, which returns a promise.

    Returns (() => Promise<any>)

    A function that ensures the provided function is only executed once and returns a promise.

      • (): Promise<any>
      • Returns Promise<any>