Promise-based lock implementation.

When someone tries to acquire a Lock they receive a promise for a release callback that is fulfilled as soon as previous lock owner invokes their release callback.

Constructors

Accessors

Methods

Constructors

Accessors

  • get isLocked(): boolean
  • true if Lock was acquired and wasn't released yet.

    Returns boolean

Methods

  • Waits for the Lock to become available and fulfills it with the callback that releases the lock.

    Returns Promise<(() => void)>