# @typeheim/fire-rx

> RxJS on steroids

Latest version **0.2.0** (published 2022-06-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @typeheim/fire-rx
pnpm add @typeheim/fire-rx
yarn add @typeheim/fire-rx
bun add @typeheim/fire-rx
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2022-06-20 |
| First published | 2020-05-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 65.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dima Kolodko |
| Maintainers | prowwid |
| Keywords | rx-flow, fire-rx, rxjs, promise, web, front-end, framework, angular, nest, back-end |

## Links

- npm: https://www.npmjs.com/package/@typeheim/fire-rx
- Homepage: https://github.com/typeheim/rx-flow#readme
- Issues: https://github.com/typeheim/rx-flow/issues
- npm.io page: https://npm.io/package/@typeheim/fire-rx

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2022-06-20
- 0.1.0 — 2021-08-06
- 0.0.8 — 2020-10-22
- 0.0.7 — 2020-09-13
- 0.0.6 — 2020-09-09
- 0.0.5 — 2020-09-07
- 0.0.4 — 2020-09-07
- 0.0.3 — 2020-09-07
- 0.0.2 — 2020-08-31
- 0.0.1 — 2020-08-26
- 0.0.0-beta.24 — 2020-08-26
- 0.0.0-beta.19 — 2020-06-27
- 0.0.0-beta.18 — 2020-06-26
- 0.0.0-beta.17 — 2020-06-18
- 0.0.0-beta.16 — 2020-06-15
- … 9 more at https://npm.io/package/@typeheim/fire-rx/versions

## README

# FireRx 

FireRx extends RxJS with different useful features. Adds memory safety and garbage collection features to work with subjects 
and subscriptions, subjects that behave both like subjects and promises to support async/await and many more. 
<p>
    <a href="https://www.npmjs.com/package/@typeheim/fire-rx" target="_blank"><img src="https://img.shields.io/npm/v/@typeheim/fire-rx.svg" alt="NPM Version" /></a>
    <a href="https://travis-ci.org/github/typeheim/rx-flow" target="_blank"><img src="https://travis-ci.org/typeheim/rx-flow.svg?branch=master" alt="Build Status" /></a>
    <a href="https://www.npmjs.com/package/@typeheim/fire-rx" target="_blank"><img src="https://img.shields.io/npm/l/@typeheim/fire-rx.svg" alt="Package License" /></a>
    <a href="https://discord.gg/dmMznp9" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
</p>

# Getting Started

Install package

```shell
yarn add @typeheim/fire-rx
//or
npm -i @typeheim/fire-rx
```

# Overview

FireRx consist of custom Observable types and additional features to work with observables.

## Custom Observable Types 

FireRx adds custom observable types, like StatefulSubject that acts as ReplaySubject and Promise so that you can use async/await operators on it as well as regular Subject methods. 
Adds memory safety and garbage collection automatically calling unsubscribe on subscriptions.

```typescript
import { StatefulSubject } from '@typeheim/fire-rx'

let subject = new StatefulSubject<number>()

subject.next(5)  
await subject // returns 5

subject.next(6)
await subject // returns 6

subject.complete() // completes subject and unsubscribe all subscriptions
```
[Read more about all custom observables...](docs/custom-observables.md)

## Garbage Collection

FireRx provide set of features for garbage collection, like StopOnDestroy decorator for FireRx [custom observables](custom-observables.md) that extends Angular
destructor(ngOnDestroy) or custom destructor (specified at decorator metadata) and stop specified observable.

```typescript
class WithoutDestructor {
    @StopOnDestroy()
    valueSubject = new ValueSubject(1)

    @StopOnDestroy()
    statefulSubject = new StatefulSubject()
}
```
[Read more about garbage collection...](docs/garbage-collection.md)

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