1.2.4 • Published 7 months ago

scope-lock v1.2.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 months ago

scope-lock

Some concurrency semantics around entering scopes

npm install scope-lock

Usage

const ScopeLock = require('scope-lock')

// normal lock runs all entries in the lock list
const l = new ScopeLock()

await l.lock()
// ... do your thing
l.unlock()

// debounced lock runs first and last entry in the lock list
const d = new ScopeLock({ debounce: true }) // debounced lock

if (await d.lock()) {
  // if we get lock do our thing
}

// wait for all current work to drain
await d.flush()

License

Apache-2.0

1.2.4

7 months ago

1.2.3

7 months ago

1.2.2

7 months ago

1.2.1

7 months ago

1.2.0

7 months ago

1.1.0

7 months ago

1.0.0

7 months ago

0.0.0

7 months ago