callbag-from-obs
Advanced tools
Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "callbag-from-obs", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Convert an observable to a callbag listenable source", | ||
@@ -5,0 +5,0 @@ "repository": { |
/** | ||
* callbag-from-obs | ||
* -------------- | ||
* | ||
* | ||
* Convert an observable (or subscribable) to a callbag listenable source. | ||
* | ||
* | ||
* `npm install callbag-from-obs` | ||
* | ||
* | ||
* Example: | ||
* | ||
* | ||
* Convert an RxJS Observable: | ||
* | ||
* | ||
* const Rx = require('rxjs'); | ||
@@ -18,3 +18,3 @@ * const fromObs = require('callbag-from-obs'); | ||
* const source = fromObs(Rx.Observable.interval(1000).take(4)); | ||
* | ||
* | ||
* observe(x => console.log(x)(source); // 0 | ||
@@ -24,8 +24,8 @@ * // 1 | ||
* // 3 | ||
* | ||
* | ||
* Convert anything that has the `.subscribe` method: | ||
* | ||
* | ||
* const fromObs = require('callbag-from-obs'); | ||
* const observe = require('callbag-observe'); | ||
* | ||
* | ||
* const subscribable = { | ||
@@ -39,3 +39,3 @@ * subscribe: (observer) => { | ||
* const source = fromObs(subscribable); | ||
* | ||
* | ||
* observe(x => console.log(x))(source); // 0 | ||
@@ -53,3 +53,4 @@ * // 1 | ||
if (t === 2 && dispose) { | ||
dispose(); | ||
if (dispose.unsubscribe) dispose.unsubscribe(); | ||
else dispose(); | ||
} | ||
@@ -56,0 +57,0 @@ }); |
6462
182
62