# can-stream-x

> Stream values into and out of computes

Latest version **1.0.2** (published 2017-05-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install can-stream-x
pnpm add can-stream-x
yarn add can-stream-x
bun add can-stream-x
```

## 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.2 |
| Published | 2017-05-03 |
| First published | 2017-04-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michael Price |
| Maintainers | webmech |
| Keywords | canjs, canjs-plugin, can-stream, can-stream-x, frp, stream |

## Links

- npm: https://www.npmjs.com/package/can-stream-x
- Repository: https://github.com/web-mech/can-stream-x
- Issues: https://github.com/web-mech/can-stream-x/issues
- npm.io page: https://npm.io/package/can-stream-x

## Dependencies (5)

- [can-util](https://npm.io/package/can-util.md) ^3.0.0
- [can-event](https://npm.io/package/can-event.md) ^3.0.0
- [can-stream](https://npm.io/package/can-stream.md) ^0.2.1
- [can-compute](https://npm.io/package/can-compute.md) ^3.0.0
- [can-observation](https://npm.io/package/can-observation.md) ^3.0.0

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2017-05-03
- 1.0.1 — 2017-04-30
- 1.0.0 — 2017-04-24
- 0.2.2 — 2017-04-21
- 0.2.1 — 2017-04-21
- 0.2.0 — 2017-04-21

## README

# can-stream-x

[![Build Status](https://travis-ci.org/web-mech/can-stream-x.svg?branch=master)](https://travis-ci.org/web-mech/can-stream-x)

Stream values into and out of computes using any streaming lib.
Great for streaming libs that return emitters as a callback.

## Syntax

```
canStreamX([options]);
```

### Notes
 - Passing falsey values for the emitter flag makes indicates the emitter is a function and should be called directly.
 - Passing falsey values for the unsubscribe method indicates the unsubscribe method is derived from the subscribe method.

### Options
 - streamConstructor - <Function> method necessary to create a stream.
 - emitMethod - <string> Which method to use as the emitter.
 - on - <string> Which method to use to subscribe.
 - off - <string> Which method to use to unsubscribe.

## Example Usage

### Using RxJs

```
var canStreamX = require('./can-stream-x');
var Rx = require('rxjs');
var Observable = Rx.Observable;

var canStream = canStreamX({
	streamConstructor: Observable.create,
    emitMethod: 'next',
    on: 'subscribe',
    off: 'unsubscribe'
});

var c = compute(0);

var stream = canStream.toStream(c);

var computeVal;

stream.subscribe((newVal) => {
	computeVal = newVal;
});

c(1);

console.log(computeVal); //1
```

### Using Kefir

```
var canStreamX = require('./can-stream-x');
var Kefir = require('kefir');
var canStream = canStreamX({
  streamConstructor: Kefir.stream,
  emitMethod: 'emit',
  on: 'onValue',
  off: 'offValue'
});
...
```

### Using Bacon

```
var canStreamX = require('./can-stream-x');
var Bacon = require('bacon');
var canStream = canStreamX({
  streamConstructor: Bacon.fromBinder,
  on: 'onValue',
  off: false
});
...
```

## testing

```
npm test
```

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