0.2.0 ā€¢ Published 27 days ago

@trenskow/semaphore v0.2.0

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
27 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.0

27 days ago

0.1.18

1 month ago

0.1.17

2 months ago

0.1.16

3 months ago

0.1.15

9 months ago

0.1.14

10 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

2 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