# callbag-remember

> 👜 Callbag operator which shares input stream between subscribers and emits last emitted value upon subscription.

Latest version **2.0.0** (published 2021-01-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install callbag-remember
pnpm add callbag-remember
yarn add callbag-remember
bun add callbag-remember
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-01-26 |
| First published | 2018-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Mateusz Burzyński |
| Maintainers | andarist |
| Keywords | callbag, callbags, remember, share-replay |

## Links

- npm: https://www.npmjs.com/package/callbag-remember
- Repository: https://github.com/Andarist/callbag-remember
- Homepage: https://github.com/Andarist/callbag-remember#readme
- Issues: https://github.com/Andarist/callbag-remember/issues
- npm.io page: https://npm.io/package/callbag-remember

## Dependencies (1)

- [callbag](https://npm.io/package/callbag.md) ^1.4.0

## Recent versions

- 2.0.0 (latest) — 2021-01-26
- 1.0.4 — 2018-07-30
- 1.0.3 — 2018-07-09
- 1.0.2 — 2018-05-30
- 1.0.1 — 2018-05-29
- 1.0.0 — 2018-04-03
- 0.0.0 — 2018-03-30

## README

# callbag-remember

Callbag operator which shares input stream between subscribers and emits last emitted value upon subscription. It behaves pretty much as Rx's [`.shareReplay(1)`](https://www.learnrxjs.io/operators/multicasting/sharereplay.html).

## Example

```js
import fromEvent from 'callbag-from-event'
import forEach from 'callbag-for-each'
import map from 'callbag-map'
import merge from 'callbag-merge'
import pipe from 'callbag-pipe'
import remember from 'callbag-remember'

const focus$ = remember(
  merge(
    map(() => false)(fromEvent(window, 'blur')),
    map(() => true)(fromEvent(window, 'focus')),
  ),
)

pipe(
  focus$,
  forEach(tabFocused => {
    // ...
  }),
)

// ...

setTimeout(() => {
  pipe(
    focus$,
    forEach(tabFocused => {
      // ... will get last emitted value immediately
    }),
  )
}, 1000)
```

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