mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-31 11:07:32 +08:00
Merge pull request #21654 from Alorel/update-semaphore
update semaphore types for 1.1.0
This commit is contained in:
7
types/semaphore/index.d.ts
vendored
7
types/semaphore/index.d.ts
vendored
@@ -1,10 +1,9 @@
|
||||
// Type definitions for semaphore v1.0.3
|
||||
// Type definitions for semaphore v1.1.0
|
||||
// Project: https://github.com/abrkn/semaphore.js
|
||||
// Definitions by: Matt Frantz <https://github.com/mhfrantz>
|
||||
// Arturas Molcanovas <https://github.com/Alorel>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
|
||||
declare function semaphore(capacity?: number): semaphore.Semaphore;
|
||||
|
||||
declare namespace semaphore {
|
||||
@@ -16,6 +15,8 @@ declare namespace semaphore {
|
||||
interface Semaphore {
|
||||
capacity: number;
|
||||
|
||||
available(n: number): boolean;
|
||||
|
||||
take(task: Task): void;
|
||||
take(n: number, task: Task): void;
|
||||
|
||||
|
||||
@@ -10,3 +10,5 @@ function task() {
|
||||
sem.take(task);
|
||||
sem.take(2, task);
|
||||
sem.leave(2);
|
||||
|
||||
const available: boolean = sem.available(2);
|
||||
|
||||
Reference in New Issue
Block a user