2.2.4 • Published 4 years ago

@sealsystems/droddel v2.2.4

Weekly downloads
11
License
MIT
Repository
github
Last release
4 years ago

@sealsystems/droddel

CircleCI AppVeyor

Serialize asynchronous calls.

Installation

$ npm install @sealsystems/droddel

Quick start

First you need to add a reference to seal-droddel within your application.

const droddel = require('@sealsystems/droddel');

To actually throttle a function, call droddel and hand over the function that shall be throttled.

E.g., if you want to serialize read access to a file, hand over a function that does the actual reading and returns its result as a promise:

const readFile = util.promisify(fs.readFile);

const throttledRead = droddel(
  async () => await readFile('/etc/passwd'));

To then read the file, simply call throttledRead:

const result = await throttledRead();

If you call throttledRead while it is already being run, the new call gets delayed.

Running the build

To build this module use roboter.

$ bot
2.2.4

4 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

6 years ago

2.1.0

6 years ago

1.1.0

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago

2.0.0

7 years ago