scope-lock
Some concurrency semantics around entering scopes
Last updated 2 years ago by mafintosh .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install scope-lock 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.2.4                                ...           latest (2 years ago)

8 Versions

  • 1.2.4                                ...           2 years ago
  • 1.2.3                                ...           2 years ago
  • 1.2.2                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Total 16
Today 0
This Week 0
This Month 9
Last Day 0
Last Week 6
Last Month 1
Dependencies (0)
None
Dev Dependencies (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE