@phylum/rxjs
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@phylum/rxjs

RxJS Integration

Installation

npm i @phylum/pipeline @phylum/rxjs rxjs

Creating observables

Pipeline tasks can be wrapped into observables that push objects with an error or with a value property representing the task result.

import { createObservable } from '@phylum/rxjs';

const task = new Task(async () => {
	return 'Hello World!';
})

const observable = createObservable(task);

observable.subscribe(({ value, error }) => {
	if (error) {
		console.error(error);
	} else {
		console.log(value);
	}
});

Creating tasks

Observables can be wrapped into tasks that emit results for each value or error that is pushed by the observable.

import { createTask } from '@phylum/rxjs';

const observable = new Observable(subscriber => {
	subscriber.next('Hello World!');
})

const task = createTask(observable);

new Task(async t => {
	console.log(await t.use(task));
})

Readme

Keywords

none

Package Sidebar

Install

npm i @phylum/rxjs

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

9.52 kB

Total Files

10

Last publish

Collaborators

  • mpt