0.2.2 ā€¢ Published 3 days ago

@trenskow/semaphore v0.2.2

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
3 days 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.2.2

3 days ago

0.2.1

14 days ago

0.2.0

2 months ago

0.1.18

2 months ago

0.1.17

3 months ago

0.1.16

4 months ago

0.1.15

10 months ago

0.1.14

11 months ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.8

1 year ago

0.1.9

1 year ago

0.1.7

2 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago