0.2.1 • Published 5 years ago
@determapp/lock v0.2.1
DetermApp Lock
A very simple lock implementation which is used at DetermApp.
import { Lock } from '@determapp/lock';
async function main() {
const myLock = new Lock();
await myLock.lockAsync(); // waits until all previous locks were followed by an unlock
console.log(myLock.getIsLocked()); // true
myLock.unlock();
console.log(myLock.getIsLocked()); // false
myLock.lockNow(); // synchronous
myLock.lockNow(); // throws if the lock is already acquired (like now)
}
main();
Commands
npm run build
- builds this component
- executed as
prepare
hook