Notification
deprecatedRepresents 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
).
It is NOT recommended to create instances of Notification
directly.
Rather, try to create POJOs matching the signature outlined in ObservableNotification.
For example: { kind: 'N', value: 1 }
, { kind: 'E', error: new Error('bad') }
, or { kind: 'C' }
.
Will be removed in v8.
§Constructors
Creates a "Next" notification object.
Always 'N'
The value to notify with if observed.
Internal implementation detail. Use {@link Notification#createNext | createNext} instead.
Creates an "Error" notification object.
Always 'E'
Always undefined
The error to notify with if observed.
Internal implementation detail. Use {@link Notification#createError | createError} instead.
§Properties
A value signifying that the notification will "next" if observed. In truth,
This is really synonymous with just checking kind === "N"
.
§Methods
Executes a notification on the appropriate handler from a list provided. If a handler is missing for the kind of notification, nothing is called and no error is thrown, it will be a noop.
A next handler
An error handler
A complete handler
Replaced with {@link Notification#observe | observe}. Will be removed in v8.
Executes a notification on the appropriate handler from a list provided. If a handler is missing for the kind of notification, nothing is called and no error is thrown, it will be a noop.
A next handler
An error handler
Replaced with {@link Notification#observe | observe}. Will be removed in v8.
Executes the next handler if the Notification is of kind
"N"
. Otherwise
this will not error, and it will be a noop.
The next handler
Replaced with {@link Notification#observe | observe}. Will be removed in v8.
Executes the appropriate handler on a passed observer
given the kind
of notification.
If the handler is missing it will do nothing. Even if the notification is an error, if
there is no error handler on the observer, an error will not be thrown, it will noop.
The observer to notify.
Replaced with {@link Notification#observe | observe}. Will be removed in v8.
Executes a notification on the appropriate handler from a list provided. If a handler is missing for the kind of notification, nothing is called and no error is thrown, it will be a noop.
A next handler
An error handler
A complete handler
Replaced with {@link Notification#observe | observe}. Will be removed in v8.
Executes a notification on the appropriate handler from a list provided. If a handler is missing for the kind of notification, nothing is called and no error is thrown, it will be a noop.
A next handler
An error handler
Replaced with {@link Notification#observe | observe}. Will be removed in v8.
Executes the next handler if the Notification is of kind
"N"
. Otherwise
this will not error, and it will be a noop.
The next handler
Replaced with {@link Notification#observe | observe}. Will be removed in v8.
Executes the appropriate handler on a passed observer
given the kind
of notification.
If the handler is missing it will do nothing. Even if the notification is an error, if
there is no error handler on the observer, an error will not be thrown, it will noop.
The observer to notify.
Returns a simple Observable that just delivers the notification represented by this Notification instance.
Will be removed in v8. To convert a Notification
to an Observable,
use of and dematerialize: of(notification).pipe(dematerialize())
.
§Static Properties
§Static Methods
A shortcut to create a Notification instance of the type complete
.
The valueless "complete" Notification.
It is NOT recommended to create instances of Notification
directly.
Rather, try to create POJOs matching the signature outlined in ObservableNotification.
For example: { kind: 'N', value: 1 }
, { kind: 'E', error: new Error('bad') }
, or { kind: 'C' }
.
Will be removed in v8.
A shortcut to create a Notification instance of the type error
from a
given error.
The "error" Notification representing the argument.
It is NOT recommended to create instances of Notification
directly.
Rather, try to create POJOs matching the signature outlined in ObservableNotification.
For example: { kind: 'N', value: 1 }
, { kind: 'E', error: new Error('bad') }
, or { kind: 'C' }
.
Will be removed in v8.
A shortcut to create a Notification instance of the type next
from a
given value.
The next
value.
The "next" Notification representing the argument.
It is NOT recommended to create instances of Notification
directly.
Rather, try to create POJOs matching the signature outlined in ObservableNotification.
For example: { kind: 'N', value: 1 }
, { kind: 'E', error: new Error('bad') }
, or { kind: 'C' }
.
Will be removed in v8.