# scope-lock

> Some concurrency semantics around entering scopes

Latest version **1.2.4** (published 2024-11-26) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install scope-lock
pnpm add scope-lock
yarn add scope-lock
bun add scope-lock
```

## Health

**Score 35/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.2.4 |
| Published | 2024-11-26 |
| First published | 2024-11-22 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Holepunch Inc. |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/scope-lock
- Repository: https://github.com/holepunchto/scope-lock
- Issues: https://github.com/holepunchto/scope-lock/issues
- npm.io page: https://npm.io/package/scope-lock

## Recent versions

- 1.2.4 (latest) — 2024-11-26
- 1.2.3 — 2024-11-26
- 1.2.2 — 2024-11-26
- 1.2.1 — 2024-11-25
- 1.2.0 — 2024-11-22
- 1.1.0 — 2024-11-22
- 1.0.0 — 2024-11-22
- 0.0.0 — 2024-11-22

## README

# scope-lock

Some concurrency semantics around entering scopes

```
npm install scope-lock
```

## Usage

``` js
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

---
_Source: https://npm.io/package/scope-lock · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
