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

Subscriber

Implements the Observer interface and extends the Subscription class. While the Observer is the public API for consuming the values of an {@link Observable}, all Observers get converted to a Subscriber, in order to provide Subscription-like capabilities such as unsubscribe. Subscriber is a common type in RxJS, and crucial for implementing operators, but it is rarely used as a public API.

class Subscriber<T> extends Subscription implements Observer<T> {
constructor(destination?: Subscriber<any> | Observer<any>);
protected destination: Subscriber<any> | Observer<any>;
protected isStopped: boolean;
 
protected _complete(): void;
protected _error(err: any): void;
protected _next(value: T): void;
complete(): void;
error(err?: any): void;
next(value?: T): void;
unsubscribe(): void;
 
static create<T>(
next?: (x?: T) => void,
error?: (e?: any) => void,
complete?: () => void,
): Subscriber<T>;
}

§Type Parameters

§Extends

§
Subscription
[src]

§Implements

§Constructors

§
new Subscriber(destination?: Subscriber<any> | Observer<any>)
[src]
@deprecated

Internal implementation detail, do not use directly. Will be made internal in v8. There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.

§Properties

§
destination: Subscriber<any> | Observer<any>
[src]
§
isStopped: boolean
[src]

§Methods

§
_complete(): void protected
[src]
§
_error(err: any): void protected
[src]
§
_next(value: T): void protected
[src]
§
complete(): void
[src]

The Observer callback to receive a valueless notification of type complete from the Observable. Notifies the Observer that the Observable has finished sending push-based notifications.

@return
§
error(err?: any): void
[src]

The Observer callback to receive notifications of type error from the Observable, with an attached Error. Notifies the Observer that the Observable has experienced an error condition.

@return
§
unsubscribe(): void
[src]

§Static Methods

§
create<T>(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber<T> deprecated
[src]

A static factory for a Subscriber, given a (potentially partial) definition of an Observer.

@param next

The next callback of an Observer.

@param error

The error callback of an Observer.

@param complete

The complete callback of an Observer.

@return

A Subscriber wrapping the (partially defined) Observer represented by the given arguments.

@deprecated

Do not use. Will be removed in v8. There is no replacement for this method, and there is no reason to be creating instances of Subscriber directly. If you have a specific use case, please file an issue.