@types/semaphore
Version:
TypeScript definitions for semaphore
40 lines (29 loc) • 1.1 kB
Markdown
# Installation
> `npm install --save @types/semaphore`
# Summary
This package contains type definitions for semaphore (https://github.com/abrkn/semaphore.js).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/semaphore.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/semaphore/index.d.ts)
````ts
declare function semaphore(capacity?: number): semaphore.Semaphore;
declare namespace semaphore {
interface Task {
(): void;
}
interface Semaphore {
capacity: number;
current: number;
available(n: number): boolean;
take(task: Task): void;
take(n: number, task: Task): void;
leave(n?: number): void;
}
}
export = semaphore;
````
### Additional Details
* Last updated: Tue, 07 Nov 2023 15:11:36 GMT
* Dependencies: none
# Credits
These definitions were written by [Matt Frantz](https://github.com/mhfrantz), [Arturas Molcanovas](https://github.com/Alorel), and [Tanguy Antoine](https://github.com/tanguyantoine).