ReplaySubject
Extends:
ReplaySubject extends Subject. As Subject is a stream of values, ReplaySubject is also a stream, but a little bit different. The difference is that ReplaySubject remembers all values that's been sent to it, and it sends all these values to new subscribers. Take a look at example.
Example:
import { ReplaySubject } from 'rxstream';
let stream$ = new ReplaySubject();
stream$.next(1);
stream$.next(2);
stream$.subscribe(value => console.log(value));
stream$.next(3);
stream$.next(4);
// Output is going ot be: 1,2,3,4
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
calls: *[] |
Method Summary
Public Methods | ||
public |
next(data: any) Send value to the stream |
|
public |
subscribe(callback: function): Subscription Subscribe to the stream |
Inherited Summary
From class Subject | ||
public |
next(data: any) Send value to the stream |
|
public |
subscribe(callback: function): Subscription Subscribe to the stream |
|
public |
subscriptionList(subscriptionList: *): * |
|
public |
unsubscribe(subscription: Subscription) Unsubscribe from the stream |
Public Constructors
Public Members
public calls: *[] source
Public Methods
public next(data: any) source
Send value to the stream
Override:
Subject#nextParams:
Name | Type | Attribute | Description |
data | any | Any value |
public subscribe(callback: function): Subscription source
Subscribe to the stream
Override:
Subject#subscribeParams:
Name | Type | Attribute | Description |
callback | function |