# @detach/loop

> create repeating task chains

Latest version **2.4.9** (published 2019-02-28) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @detach/loop
pnpm add @detach/loop
yarn add @detach/loop
bun add @detach/loop
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.4.9 |
| Published | 2019-02-28 |
| First published | 2019-02-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | detach |
| Maintainers | detach |
| Keywords | task, repeating, chain, tasks, scheduler, loop |

## Links

- npm: https://www.npmjs.com/package/@detach/loop
- Repository: https://github.com/117/loop
- Homepage: https://github.com/117/loop#readme
- Issues: https://github.com/117/loop/issues
- npm.io page: https://npm.io/package/@detach/loop

## Recent versions

- 2.4.9 (latest) — 2019-02-28

## README

# loop

![](https://badgen.net/npm/v/@detach/loop?color=grey)
![](https://badgen.net/npm/dw/@detach/loop)
![](https://badgen.net/packagephobia/install/@detach/loop?color=055ff3)
![](https://badgen.net/badge/code%20style/prettier/ff51bc)

### install

`npm install --save @detach/loop`

### usage

The following loop will run all tasks once, in place.

```javascript
import loop from "@detach/loop";

loop()
  .do(() => console.log("how are you?"))
  .do(() => console.log("good"))
  .once();
```

### methods

These methods are available to Loop objects.

| Method            | Description                  |
| :---------------- | :--------------------------- |
| `once(?async)`    | Perform the loop once.       |
| `forever(?async)` | Perform the loop infinitely. |
| `cancel()`        | Cancel a forever loop.       |

### async or sync

By default all loops are **synchronous**, however it is easy to change that.  
Simply pass a boolean to the `.once` or `.forever` methods, for an **asynchronous** loop use `true`.

### contribute

Pull requests are encouraged.

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