Skip to content

A callbag subject (source, sink) that repeats its last value on connection.

License

Notifications You must be signed in to change notification settings

zebulonj/callbag-behavior-subject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

callbag-behavior-subject

A callbag subject (listener, sink) that repeats its last value on connection.

npm install callbag-behavior-subject

Usage:

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!

About

A callbag subject (source, sink) that repeats its last value on connection.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published