Skip to content

Commit 402a4d3

Browse files
Merge pull request #1 from knowledgecode/develop
Add abort parameter to unlock() method
2 parents caa6483 + 349b555 commit 402a4d3

5 files changed

Lines changed: 586 additions & 482 deletions

File tree

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,27 @@ blokr.unlock(); // Call count: 1 (still blocked)
7676
blokr.unlock(); // Call count: 0 (unblocked)
7777
```
7878

79-
### `blokr.unlock()`
79+
### `blokr.unlock(abort?: boolean)`
8080

81-
Unblocks user interactions. Decrements the internal counter.
81+
Unblocks user interactions. By default, decrements the internal counter. When `abort` is `true`, immediately resets the counter to zero and releases all locks.
82+
83+
**Parameters:**
84+
85+
- `abort` (optional): When `true`, immediately unlocks all locks. Default: `false`
86+
87+
```typescript
88+
// Normal unlock behavior (decrements counter)
89+
blokr.lock(); // Lock count: 1
90+
blokr.lock(); // Lock count: 2
91+
92+
blokr.unlock(); // Lock count: 1 (still locked)
93+
blokr.unlock(); // Lock count: 0 (unlocked)
94+
95+
// Emergency unlock with abort
96+
blokr.lock(); // Lock count: 1
97+
blokr.lock(); // Lock count: 2
98+
blokr.unlock(true); // Lock count: 0 (immediately unlocked)
99+
```
82100

83101
### `blokr.isLocked(): boolean`
84102

0 commit comments

Comments
 (0)