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
).
Test:
Static Method Summary
Static Public Methods | ||
public static |
createComplete(): Notification<any> A shortcut to create a Notification instance of the type |
|
public static |
createError(err: any): Notification<T> A shortcut to create a Notification instance of the type |
|
public static |
createNext(value: T): Notification<T> A shortcut to create a Notification instance of the type |
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 |
|
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 |
Delivers to the given |
|
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
.
public static createError(err: any): Notification<T> source
A shortcut to create a Notification instance of the type error
from a
given error.
Params:
Name | Type | Attribute | Description |
err | any |
|
The |
public static createNext(value: T): Notification<T> source
A shortcut to create a Notification instance of the type next
from a
given value.
Params:
Name | Type | Attribute | Description |
value | T | The |
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.
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.
Return:
any |
Test:
public observe(observer: Observer): * source
Delivers to the given observer
the value wrapped by this Notification.
Params:
Name | Type | Attribute | Description |
observer | Observer |
Return:
* |
public toObservable(): any source
Returns a simple Observable that just delivers the notification represented by this Notification instance.
Return:
any |