# forever-task

> - Forever task is a task which only stops when receiving `stop` signal. While running, it emits some data. - Forever tasks include `crawling`, `micro service`, etc - Allow distributed workers

Latest version **0.1.2** (published 2018-08-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install forever-task
pnpm add forever-task
yarn add forever-task
bun add forever-task
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2018-08-04 |
| First published | 2018-08-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 77.8 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | tndgroup |

## Links

- npm: https://www.npmjs.com/package/forever-task
- Repository: https://github.com/duytai/forever-task
- npm.io page: https://npm.io/package/forever-task

## Dependencies (6)

- [q](https://npm.io/package/q.md) ^1.5.1
- [uuid](https://npm.io/package/uuid.md) ^3.3.2
- [redis](https://npm.io/package/redis.md) ^2.8.0
- [getmac](https://npm.io/package/getmac.md) ^1.4.3
- [msgpack](https://npm.io/package/msgpack.md) ^1.0.2
- [underscore](https://npm.io/package/underscore.md) ^1.9.1

## Recent versions

- 0.1.2 (latest) — 2018-08-04
- 0.1.1 — 2018-08-04
- 0.1.0 — 2018-08-04
- 0.0.8 — 2018-08-03
- 0.0.6 — 2018-08-03
- 0.0.4 — 2018-08-03
- 0.0.2 — 2018-08-03
- 0.0.1 — 2018-08-03

## README

# Forever Task

- Forever task is a task which only stops when receiving `stop` signal. While running, it emits some data.
- Forever tasks include `crawling`, `micro service`, etc
- Allow distributed workers


### Installation

```bash
$ npm install forever-task
```

### Usage

#### 1. Worker

```javascript
const { Forever } = require('forever-task')
const forever = new Forever()
forever.process({
  MyId: {
    resolver(_, { send }) {
      send({ ping: true })
    }
  }
})
```
#### 2. start/stop Worker

```javascript
const jobId = forever.start('MyId')
// stop
forever.stop(jobId)
```
#### 3. ubscribe/unsubscribe to data

```javascript
const subId = forever.subscribe('MyId')
// unsubscribe
forever.unsubscribe(subId)
```

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