H5P NodeJS Library
    Preparing search index...

    Offers locking a mechanism to prevent race conditions.

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Type Parameters

      • T

      Parameters

      • key: string

        the key of the resource to lock

      • callback: () => Promise<T>

        the code which should run once the lock was acquired

      • options: { maxOccupationTime: number; timeout: number }
        • maxOccupationTime: number

          how long to wait until the code in callback is finished

        • timeout: number

          how long to wait until the lock is acquired

      Returns Promise<T>

      'timeout' or 'occupation-time-exceed' errors