node-synchronized
v1.0.1
Published
```typescript import { Synchronized } from 'node-synchronized';
Downloads
107
Readme
node-synchronized
import { Synchronized } from 'node-synchronized';
const block = new Synchronized();
block.synchronized((isFirst) => {
// When acquiring the first lock, isFirst == true.
});
block.synchronized((first) => {
// When acquiring the first lock, isFirst == true.
});
example
output:
A: isFirst=true
B: isFirst=false
C: isFirst=true
D: isFirst=false