@3xpo/locked
TypeScript icon, indicating that this package has built-in type declarations

0.1.14 • Public • Published

@3xpo/locked

Locking Library for the 21st Century

Usage

import Locked from '@3xpo/locked';

const lock = new Locked();
setTimeout(async () => {
  const unlock = await lock.lock('test');
  await new Promise(rs => setTimeout(rs, 10));
  console.log('3');
  unlock();
  console.log('4');
}, 10);
(async () => {
  const unlock = await lock.lock('test');
  await new Promise(rs => setTimeout(rs, 100));
  console.log('1');
  unlock();
  console.log('2');
})();

will output 1, 2, 3, 4.

Readme

Keywords

none

Package Sidebar

Install

npm i @3xpo/locked

Weekly Downloads

60

Version

0.1.14

License

MIT

Unpacked Size

32.9 kB

Total Files

11

Last publish

Collaborators

  • exponentialworkload