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
).
class Notification<T> {
static createNext<T>(value: T): Notification<T>
static createError<T>(err?: any): Notification<T>
static createComplete(): Notification<any>
constructor(kind: NotificationKind, value?: T, error?: any)
hasValue: boolean
kind: NotificationKind
value?: T
error?: any
observe(observer: PartialObserver<T>): any
do(next: (value: T) => void, error?: (err: any) => void, complete?: () => void): any
accept(nextOrObserver: PartialObserver<T> | ((value: T) => void), error?: (err: any) => void, complete?: () => void)
toObservable(): Observable<T>
}
Static Methods
createError() | ||
---|---|---|
A shortcut to create a Notification instance of the type |
||
Parameters
Returns
|
createComplete() |
---|
A shortcut to create a Notification instance of the type |
ParametersThere are no parameters. Returns
|
Constructor
Parameters
|
Properties
Property | Type | Description |
---|---|---|
hasValue | ||
kind | Declared in constructor. | |
value | Declared in constructor. | |
error | Declared in constructor. |
Methods
observe() | ||
---|---|---|
Delivers to the given |
||
Parameters
Returns
|
do() | ||||||
---|---|---|---|---|---|---|
Given some |
||||||
Parameters
Returns
|
accept() | ||||||
---|---|---|---|---|---|---|
Takes an Observer or its individual callback functions, and calls |
||||||
Parameters
|
toObservable() |
---|
Returns a simple Observable that just delivers the notification represented by this Notification instance. |
ParametersThere are no parameters. Returns
|