# micro-observable

> RxJS6-style observables in less than 1kb

Latest version **1.3.0** (published 2018-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install micro-observable
pnpm add micro-observable
yarn add micro-observable
bun add micro-observable
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2018-11-08 |
| First published | 2018-07-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Mike North |
| Maintainers | northm |
| Keywords | ember-addon |

## Links

- npm: https://www.npmjs.com/package/micro-observable
- Repository: https://github.com/mike-north/micro-observable
- Homepage: https://github.com/mike-north/micro-observable#readme
- Issues: https://github.com/mike-north/micro-observable/issues
- npm.io page: https://npm.io/package/micro-observable

## Recent versions

- 1.3.0 (latest) — 2018-11-08
- 1.2.2 — 2018-11-04
- 1.2.1 — 2018-10-03
- 1.2.0 — 2018-10-03
- 1.1.5 — 2018-10-03
- 1.1.4 — 2018-08-06
- 1.1.3 — 2018-08-06
- 1.1.2 — 2018-07-25
- 1.1.1 — 2018-07-25
- 1.1.0 — 2018-07-25
- 1.0.0 — 2018-07-25

## README

# micro-observable

RxJS6-style observables in less than 1kb, with code taken from RxJS, [toy-rx](https://github.com/staltz/toy-rx) and more.

[![Build Status](https://travis-ci.org/mike-north/micro-observable.svg?branch=master)](https://travis-ci.org/mike-north/micro-observable)
[![Version](https://img.shields.io/npm/v/micro-observable.svg)](http://npmjs.com/package/micro-observable)

## Setup

```sh
npm install -D micro-observable
```

## Use

```ts
import { Observable, map, filter } from 'micro-observable';

let myObs = Observable.create(observer => { // Create an observable
  let x = 0;
  let y = setInterval(() => {
    observer.next(x++); // that emits incrementing values
  }, 1000); // each second
  return function cleanup() {
    clearInterval(y); // and cleans up after its self
  }
}).pipe(
  map(x => x * x), // square each member
  filter(x => x % 3 === 0) // keep only those that are multiples of 3
);

let s = myObs.subscribe(x => {
  console.log(x);
});

setTimeout(() => {
  s.unsubscribe(); // unsubscribe
}, 10000); // after 10s
```

## Is this equivalent to RxJS?

Absolutely not. There are tons of edge and corner cases that this library doesn't aim to handle. `micro-observable` is great for simple producers and consumers, where a full-blown FRP library would be overkill.

---
(c) 2018

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