• Implements a global exclusive lock that works only in the current process. Useful for environments like React Native or other non-browser single-process (i.e. no concept of "tabs") environments.

    Use #navigatorLock in browser environments.

    Type Parameters

    • R

    Parameters

    • name: string

      Name of the lock to be acquired.

    • acquireTimeout: number

      If negative, no timeout. If 0 an error is thrown if the lock can't be acquired without waiting. If positive, the lock acquire will time out after so many milliseconds. An error is a timeout if it has isAcquireTimeout set to true.

    • fn: (() => Promise<R>)

      The operation to run once the lock is acquired.

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

    Returns Promise<R>

Generated using TypeDoc