Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zebulonj/callbag-behavior-subject
A callbag subject (source, sink) that repeats its last value on connection.
https://github.com/zebulonj/callbag-behavior-subject
callbag observables pub-sub reactive rx
Last synced: 3 months ago
JSON representation
A callbag subject (source, sink) that repeats its last value on connection.
- Host: GitHub
- URL: https://github.com/zebulonj/callbag-behavior-subject
- Owner: zebulonj
- License: mit
- Created: 2018-02-06T23:39:20.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-07T15:14:35.000Z (about 6 years ago)
- Last Synced: 2024-10-02T12:36:25.611Z (3 months ago)
- Topics: callbag, observables, pub-sub, reactive, rx
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-callbags - behavior-subject
README
# callbag-behavior-subject
A callbag subject (listener, sink) that repeats its last value on connection.
`npm install callbag-behavior-subject`
## Usage:
```js
import makeBehaviorSubject from 'callbag-behavior-subject';
import subscribe from 'callbag-subscribe';
import pipe from 'callbag-pipe';const subject = makeBehaviorSubject( 'A' );
const observer = {
next: val => console.log( val ),
error: err => console.error( err ),
complete: () => console.log( 'Done!' )
};const dispose = pipe(
subject,
subscribe( observer )
);subject( 1, 'B' );
subject( 2 );// A
// B
// Done!
```