Home Manual Reference Source Test Repository
import {Notification} from '@reactivex/rxjs/es6/Notification.js'
public class | source

Notification

Represents a push-based event or value that an Observable can emit. This class is particularly useful for operators that manage notifications, like materialize, dematerialize, observeOn, and others. Besides wrapping the actual delivered value, it also annotates it with metadata of, for instance, what type of push message it is (next, error, or complete).

See:

Test:

Static Method Summary

Static Public Methods
public static

A shortcut to create a Notification instance of the type complete.

public static

createError(err: any): Notification<T>

A shortcut to create a Notification instance of the type error from a given error.

public static

createNext(value: T): Notification<T>

A shortcut to create a Notification instance of the type next from a given value.

Method Summary

Public Methods
public

accept(nextOrObserver: Observer | function(value: T): void, error: function(err: any): void, complete: function(): void): any

Takes an Observer or its individual callback functions, and calls observe or do methods accordingly.

public

do(next: function(value: T): void, error: function(err: any): void, complete: function(): void): any

Given some Observer callbacks, deliver the value represented by the current Notification to the correctly corresponding callback.

public

observe(observer: Observer): *

Delivers to the given observer the value wrapped by this Notification.

public

toObservable(): any

Returns a simple Observable that just delivers the notification represented by this Notification instance.

Static Public Methods

public static createComplete(): Notification<any> source

A shortcut to create a Notification instance of the type complete.

Return:

Notification<any>

The valueless "complete" Notification.

public static createError(err: any): Notification<T> source

A shortcut to create a Notification instance of the type error from a given error.

Params:

NameTypeAttributeDescription
err any
  • optional

The error error.

Return:

Notification<T>

The "error" Notification representing the argument.

public static createNext(value: T): Notification<T> source

A shortcut to create a Notification instance of the type next from a given value.

Params:

NameTypeAttributeDescription
value T

The next value.

Return:

Notification<T>

The "next" Notification representing the argument.

Public Methods

public accept(nextOrObserver: Observer | function(value: T): void, error: function(err: any): void, complete: function(): void): any source

Takes an Observer or its individual callback functions, and calls observe or do methods accordingly.

Params:

NameTypeAttributeDescription
nextOrObserver Observer | function(value: T): void

An Observer or the next callback.

error function(err: any): void
  • optional

An Observer error callback.

complete function(): void
  • optional

An Observer complete callback.

Return:

any

public do(next: function(value: T): void, error: function(err: any): void, complete: function(): void): any source

Given some Observer callbacks, deliver the value represented by the current Notification to the correctly corresponding callback.

Params:

NameTypeAttributeDescription
next function(value: T): void

An Observer next callback.

error function(err: any): void
  • optional

An Observer error callback.

complete function(): void
  • optional

An Observer complete callback.

Return:

any

Test:

public observe(observer: Observer): * source

Delivers to the given observer the value wrapped by this Notification.

Params:

NameTypeAttributeDescription
observer Observer

Return:

*

public toObservable(): any source

Returns a simple Observable that just delivers the notification represented by this Notification instance.

Return:

any