@lauf/lock v1.1.1
Lightweight Lock for Mutual Exclusion
Lauf Lock
Logo - Diego Naive, Noun Project.
Install
npm install @lauf/lock --save
@lauf/lock
is an implementation of Mutual Exclusion or Mutex. It is incredibly lightweight with no dependencies and is suitable for adoption server-side or client-side in Typescript or Javascript.
To get a lock on a particular key, call lock.acquire(key)
. The Promise returned will block until every prior requester for that key has already acquired
and released
their lock, meaning it's your turn. The promise will then resolve to your very own Release
function, indicating you have the lock. Finally, call the Release
function to notify you have given up the lock.
Browse the API.
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago