# callbag-subscribe

> A callbag sink (listener) that connects an Observer a-la RxJS.

Latest version **1.5.1** (published 2019-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install callbag-subscribe
pnpm add callbag-subscribe
yarn add callbag-subscribe
bun add callbag-subscribe
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.1 |
| Published | 2019-02-12 |
| First published | 2018-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Zebulon Young |
| Maintainers | zebulonj |
| Keywords | callbag, rx, frp, reactive, functional, observable, disposable |

## Links

- npm: https://www.npmjs.com/package/callbag-subscribe
- Repository: https://github.com/zebulonj/callbag-subscribe
- Homepage: https://github.com/zebulonj/callbag-subscribe#readme
- Issues: https://github.com/zebulonj/callbag-subscribe/issues
- npm.io page: https://npm.io/package/callbag-subscribe

## Dependencies (1)

- [callbag](https://npm.io/package/callbag.md) ^1.2.0

## Recent versions

- 1.5.1 (latest) — 2019-02-12
- 1.5.0 — 2018-11-07
- 1.4.1 — 2018-07-07
- 1.4.0 — 2018-07-07
- 1.3.0 — 2018-07-07
- 1.2.0 — 2018-02-07
- 1.1.1 — 2018-02-07
- 1.1.0 — 2018-02-06
- 1.0.2 — 2018-02-06
- 1.0.1 — 2018-02-06
- 1.0.0 — 2018-02-06

## README

# callbag-subscribe 👜

[![CircleCI](https://img.shields.io/circleci/project/zebulonj/callbag-subscribe.svg)]() [![npm](https://img.shields.io/npm/v/callbag-subscribe.svg)]() [![npm](https://img.shields.io/npm/dt/callbag-subscribe.svg)]()

A callbag sink (listener) that connects an Observer a-la RxJS.

`npm install callbag-subscribe`

## Usage:

### Simple (next only)

```js
import pipe from 'callbag-pipe';
import interval from 'callbag-interval';
import subscribe from 'callbag-subscribe';

const source = interval( 10 );

pipe(
  source,
  subscribe( val => console.log( val ) )
);

// 0
// 1
// 2
// 3
// 4
// 5
// 6
// 7
// 8
// 9
```

### Complete observer

```js
import pipe from 'callbag-pipe';
import interval from 'callbag-interval';
import subscribe from 'callbag-subscribe';

const source = interval( 10 );

pipe(
  source,
  subscribe({
    next: val => console.log( val ),
    complete: () => console.log( 'Done!' ),
    error: err => console.error( err )
  })
);

// 0
// 1
// 2
// 3
// 4
// 5
// 6
// 7
// 8
// 9
// Done!
```

### Disposal

Use the returned disposal function to terminate the subscription.

```js
const source = fromEvent( document.body, 'click' );

const dispose = pipe(
  source,
  subscribe({
    next: ev => console.log( 'Click:', ev )
  })
);

// Do some stuff...

dispose(); // Terminate the subscription.
```

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