Function mutex

  • Executes only one instance of give code at a time. For parallel calls, it returns the result of the ongoing execution.

    Type Parameters

    • This
    • Args extends any[]
    • Return

    Parameters

    • fn: ((this, ...args) => Promise<Return>)
    • Optional context: ClassMethodDecoratorContext<This, ((this, ...args) => Promise<Return>)>

    Returns ((this, ...args) => Promise<Return>)