Subject interface
An async callback collection with a single onComplete or onError event when finished, and multiple calls to the onNext function
Signature:
export interface Subject<T>
Methods
Method | Description |
---|---|
clear() | Unregisters all handlers registered with this subject stream. |
subscribe(onNext, onComplete, onError) | Registers handlers with this subject stream. |
unsubscribe(onNext, onComplete, onError) | Unregisters handlers with this subject stream. The callbacks passed to this method must be the same ones that were passed to Subject.subscribe() |
Subject.clear() method
Unregisters all handlers registered with this subject stream.
Signature:
clear(): void;
Returns:
void
Subject.subscribe() method
Registers handlers with this subject stream.
Signature:
subscribe(onNext: SubjectOnNext<T>, onComplete?: SubjectOnComplete, onError?: SubjectOnError): void;
Parameters
Parameter | Type | Description |
---|---|---|
onNext | SubjectOnNext<T> | A function that is called for every update |
onComplete | SubjectOnComplete | (Optional) A function that is called at the end when the stream has ended |
onError | SubjectOnError | (Optional) A function that is called when an error occurs |
Returns:
void
Subject.unsubscribe() method
Unregisters handlers with this subject stream. The callbacks passed to this method must be the same ones that were passed to Subject.subscribe()
Signature:
unsubscribe(onNext: SubjectOnNext<T>, onComplete?: SubjectOnComplete, onError?: SubjectOnError): void;
Parameters
Parameter | Type | Description |
---|---|---|
onNext | SubjectOnNext<T> | A function that is called for every update |
onComplete | SubjectOnComplete | (Optional) A function that is called at the end when the stream has ended |
onError | SubjectOnError | (Optional) A function that is called when an error occurs |
Returns:
void
Updated 7 months ago