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

MethodDescription
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

ParameterTypeDescription
onNextSubjectOnNext<T>A function that is called for every update
onCompleteSubjectOnComplete(Optional) A function that is called at the end when the stream has ended
onErrorSubjectOnError(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

ParameterTypeDescription
onNextSubjectOnNext<T>A function that is called for every update
onCompleteSubjectOnComplete(Optional) A function that is called at the end when the stream has ended
onErrorSubjectOnError(Optional) A function that is called when an error occurs

Returns:

void