1 /** PURE_IMPORTS_START _observable_empty,_observable_of,_observable_throwError PURE_IMPORTS_END */
2 import { empty } from './observable/empty';
3 import { of } from './observable/of';
4 import { throwError } from './observable/throwError';
5 export var NotificationKind;
6 /*@__PURE__*/ (function (NotificationKind) {
7 NotificationKind["NEXT"] = "N";
8 NotificationKind["ERROR"] = "E";
9 NotificationKind["COMPLETE"] = "C";
10 })(NotificationKind || (NotificationKind = {}));
11 var Notification = /*@__PURE__*/ (function () {
12 function Notification(kind, value, error) {
16 this.hasValue = kind === 'N';
18 Notification.prototype.observe = function (observer) {
21 return observer.next && observer.next(this.value);
23 return observer.error && observer.error(this.error);
25 return observer.complete && observer.complete();
28 Notification.prototype.do = function (next, error, complete) {
32 return next && next(this.value);
34 return error && error(this.error);
36 return complete && complete();
39 Notification.prototype.accept = function (nextOrObserver, error, complete) {
40 if (nextOrObserver && typeof nextOrObserver.next === 'function') {
41 return this.observe(nextOrObserver);
44 return this.do(nextOrObserver, error, complete);
47 Notification.prototype.toObservable = function () {
51 return of(this.value);
53 return throwError(this.error);
57 throw new Error('unexpected notification kind value');
59 Notification.createNext = function (value) {
60 if (typeof value !== 'undefined') {
61 return new Notification('N', value);
63 return Notification.undefinedValueNotification;
65 Notification.createError = function (err) {
66 return new Notification('E', undefined, err);
68 Notification.createComplete = function () {
69 return Notification.completeNotification;
71 Notification.completeNotification = new Notification('C');
72 Notification.undefinedValueNotification = new Notification('N', undefined);
75 export { Notification };
76 //# sourceMappingURL=Notification.js.map