Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Subject

A Subject is a special type of Observable that allows values to be multicasted to many Observers. Subjects are like EventEmitters.

Every Subject is an Observable and an Observer. You can subscribe to a Subject, and you can call next to feed values as well as error and complete.

class Subject<T> extends Observable<T> implements SubscriptionLike {
constructor();
private currentObservers;
closed: boolean;
hasError: boolean;
isStopped: boolean;
get observed(): boolean;
observers: Observer<T>[];
thrownError: any;
 
asObservable(): Observable<T>;
complete(): void;
error(err: any): void;
lift<R>(operator: Operator<T, R>): Observable<R>;
next(value: T): void;
unsubscribe(): void;
 
static create: (...args: any[]) => any;
}

§Type Parameters

§Extends

§
Observable<T>
[src]

§Implements

§Constructors

§
new Subject()
[src]

§Properties

§
currentObservers
[src]
§
closed: boolean
[src]
§
hasError: boolean
[src]
§
isStopped: boolean
[src]
§
observed: boolean readonly
[src]
§
observers: Observer<T>[]
[src]
§
thrownError: any
[src]

§Methods

§
asObservable(): Observable<T>
[src]

Creates a new Observable with this Subject as the source. You can do this to create custom Observer-side logic of the Subject and conceal it from code that uses the Observable.

@return

Observable that the Subject casts to

§
complete(): void
[src]
§
error(err: any): void
[src]
§
lift<R>(operator: Operator<T, R>): Observable<R> deprecated
[src]
@deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

§
unsubscribe(): void
[src]

§Static Properties

§
create: (...args: any[]) => any
[src]

Creates a "subject" by basically gluing an observer to an observable.