Merge pull request #21654 from Alorel/update-semaphore

update semaphore types for 1.1.0
This commit is contained in:
Armando Aguirre
2017-12-01 14:28:39 -08:00
committed by GitHub
2 changed files with 6 additions and 3 deletions

View File

@@ -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;

View File

@@ -10,3 +10,5 @@ function task() {
sem.take(task);
sem.take(2, task);
sem.leave(2);
const available: boolean = sem.available(2);