0.1.15 ā€¢ Published 2 months ago

@trenskow/semaphore v0.1.15

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
2 months ago

@trenskow/semaphore

A small library for waiting in JavaScript.

Usage

Create a new semaphore like below.

const Semaphore = require('@trenskow/semaphore');

const mySemaphore = new Semaphore();

Waiting

To wait do as below.

await mySemaphore.wait();

Signalling and broadcasting

To signal (from another place) that one of the waiters can continue, do as below.

mySemaphore.signal();

ā€“ or to broadcast to all awaiters to conitnue.

mySemaphore.broadcast();

Errors

You can also reject all awaiters with an error.

mySemphore.reject(myError);

LICENSE

See license in LICENSE.

0.1.15

2 months ago

0.1.14

4 months ago

0.1.10

9 months ago

0.1.11

8 months ago

0.1.12

7 months ago

0.1.13

7 months ago

0.1.8

10 months ago

0.1.9

10 months ago

0.1.7

1 year ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago