# seal-droddel

> Serialize asynchronous calls

Latest version **1.0.1** (published 2017-02-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install seal-droddel
pnpm add seal-droddel
yarn add seal-droddel
bun add seal-droddel
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-02-08 |
| First published | 2017-02-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | SEAL Systems AG |
| Maintainers | manni19682 |

## Links

- npm: https://www.npmjs.com/package/seal-droddel
- Repository: https://github.com/sealsystems/seal-droddel
- Homepage: https://github.com/sealsystems/seal-droddel#readme
- Issues: https://github.com/sealsystems/seal-droddel/issues
- npm.io page: https://npm.io/package/seal-droddel

## Recent versions

- 1.0.1 (latest) — 2017-02-08

## README

# seal-droddel

[![CircleCI](https://circleci.com/gh/sealsystems/seal-droddel.svg?style=svg)](https://circleci.com/gh/sealsystems/seal-droddel)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/9tmhr4nt442rkvjy?svg=true)](https://ci.appveyor.com/project/Plossys/seal-droddel)

Serialize asynchronous calls.

## Installation

```bash
$ npm install seal-droddel
```

## Quick start

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

```javascript
const droddel = require('seal-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 `fs.readFile` call and return its result using a
callback:

```javascript
const throttledRead = droddel((callback) => {
  fs.readFile('/etc/passwd', callback);
});
```

To then read the file, simply call `throttledRead`:

```javascript
throttledRead((err, data) => {
  // ...
});
```

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

## Referencing this

If you need to access `this` from within the function that shall be
throttled, call the `throttledRead` function using `call` and provide the
object that you want to use as `this`.

E.g., if you want to preserve the outer `this`, simply hand it over:

```javascript
throttledRead.call(this, (err, data) => {
  // ...
});
```

## Running the build

To build this module use [roboter](https://www.npmjs.com/package/roboter).

```bash
$ bot
```

---
_Source: https://npm.io/package/seal-droddel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
