@wpazderski/js-utils
    Preparing search index...

    Class Lock

    Provides a simple lock mechanism to ensure that only one operation can be executed at a time.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Executes a function while holding the lock. The function will be awaited. If an error is thrown during the function execution, it will be propagated; lock will be released regardless.

      Type Parameters

      • T

      Parameters

      • func: () => T | Promise<T>

        The function to execute while holding the lock.

      Returns Promise<T>

      The result of the function execution (awaited).