```typescript import { Synchronized } from 'node-synchronized';
npm install node-synchronizedtypescript
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
example.ts
output:
`text
A: isFirst=true
B: isFirst=false
C: isFirst=true
D: isFirst=false
``