# knotty-lock

> Basic lock system for asynchronous requests (ex: Ajax)

Latest version **1.0.3** (published 2016-08-30) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2016-08-30 |
| First published | 2016-08-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Roland Durocher |
| Maintainers | viralwarrior012 |
| Keywords | knottysoft, lock |

## Links

- npm: https://www.npmjs.com/package/knotty-lock
- Repository: https://github.com/viralwarrior012/knotty-lock
- Homepage: https://github.com/viralwarrior012/knotty-lock#readme
- Issues: https://github.com/viralwarrior012/knotty-lock/issues
- npm.io page: https://npm.io/package/knotty-lock

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2016-08-30
- 1.0.2 — 2016-08-30
- 1.0.1 — 2016-08-30
- 1.0.0 — 2016-08-26

## README

# KNOTTY-LOCK

# Description
Lock system for asynchronous requests (ex: Ajax)

# Why a lock?
Was discussing an issue with a work colleague where an ajax request would be executed multiple times because the triggered control existed multiple times in the DOM. We found a work around prior to writing this plugin, but this simplifies the whole problem by stopping the call dead in it's tracks after it has been called once and only allows it to be called again once it has be released. 

# How does it work?
First, link the knotty-lock.js file in your page or as a package in node.js.
Once that's done, it's as simple as englobing the lock around your request, and unlocking the element once the request is complete (success, error, etc.)

###To lock: 
```javascript
if (knottyLock.add(keyOfYourChoosing)) { //ajax request here } 
```

###To unlock
```javascript
 knottyLock.remove(keyOfYourChoosing); /* once request is complete (success, erroc, etc.) */
```
    
#### View the example for a better overview of how it works

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