mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
26 lines
559 B
TypeScript
26 lines
559 B
TypeScript
// Type definitions for semaphore v1.0.3
|
|
// Project: https://github.com/abrkn/semaphore.js
|
|
// Definitions by: Matt Frantz <https://github.com/mhfrantz/>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
|
|
|
|
declare function semaphore(capacity?: number): semaphore.Semaphore;
|
|
|
|
declare namespace semaphore {
|
|
|
|
interface Task {
|
|
(): void;
|
|
}
|
|
|
|
interface Semaphore {
|
|
capacity: number;
|
|
|
|
take(task: Task): void;
|
|
take(n: number, task: Task): void;
|
|
|
|
leave(n?: number): void;
|
|
}
|
|
}
|
|
export = semaphore;
|