Skip to content

Commit dd1b8e4

Browse files
committed
Update README.md to document unlock() abort parameter
Added documentation for the new optional abort parameter that allows immediate unlock regardless of lock count.
1 parent 1977dd5 commit dd1b8e4

1 file changed

Lines changed: 20 additions & 2 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)