Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Notification.d.ts 3.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import { PartialObserver } from './types';
  2. import { Observable } from './Observable';
  3. /**
  4. * @deprecated NotificationKind is deprecated as const enums are not compatible with isolated modules. Use a string literal instead.
  5. */
  6. export declare enum NotificationKind {
  7. NEXT = "N",
  8. ERROR = "E",
  9. COMPLETE = "C"
  10. }
  11. /**
  12. * Represents a push-based event or value that an {@link Observable} can emit.
  13. * This class is particularly useful for operators that manage notifications,
  14. * like {@link materialize}, {@link dematerialize}, {@link observeOn}, and
  15. * others. Besides wrapping the actual delivered value, it also annotates it
  16. * with metadata of, for instance, what type of push message it is (`next`,
  17. * `error`, or `complete`).
  18. *
  19. * @see {@link materialize}
  20. * @see {@link dematerialize}
  21. * @see {@link observeOn}
  22. *
  23. * @class Notification<T>
  24. */
  25. export declare class Notification<T> {
  26. kind: 'N' | 'E' | 'C';
  27. value?: T;
  28. error?: any;
  29. hasValue: boolean;
  30. constructor(kind: 'N' | 'E' | 'C', value?: T, error?: any);
  31. /**
  32. * Delivers to the given `observer` the value wrapped by this Notification.
  33. * @param {Observer} observer
  34. * @return
  35. */
  36. observe(observer: PartialObserver<T>): any;
  37. /**
  38. * Given some {@link Observer} callbacks, deliver the value represented by the
  39. * current Notification to the correctly corresponding callback.
  40. * @param {function(value: T): void} next An Observer `next` callback.
  41. * @param {function(err: any): void} [error] An Observer `error` callback.
  42. * @param {function(): void} [complete] An Observer `complete` callback.
  43. * @return {any}
  44. */
  45. do(next: (value: T) => void, error?: (err: any) => void, complete?: () => void): any;
  46. /**
  47. * Takes an Observer or its individual callback functions, and calls `observe`
  48. * or `do` methods accordingly.
  49. * @param {Observer|function(value: T): void} nextOrObserver An Observer or
  50. * the `next` callback.
  51. * @param {function(err: any): void} [error] An Observer `error` callback.
  52. * @param {function(): void} [complete] An Observer `complete` callback.
  53. * @return {any}
  54. */
  55. accept(nextOrObserver: PartialObserver<T> | ((value: T) => void), error?: (err: any) => void, complete?: () => void): any;
  56. /**
  57. * Returns a simple Observable that just delivers the notification represented
  58. * by this Notification instance.
  59. * @return {any}
  60. */
  61. toObservable(): Observable<T>;
  62. private static completeNotification;
  63. private static undefinedValueNotification;
  64. /**
  65. * A shortcut to create a Notification instance of the type `next` from a
  66. * given value.
  67. * @param {T} value The `next` value.
  68. * @return {Notification<T>} The "next" Notification representing the
  69. * argument.
  70. * @nocollapse
  71. */
  72. static createNext<T>(value: T): Notification<T>;
  73. /**
  74. * A shortcut to create a Notification instance of the type `error` from a
  75. * given error.
  76. * @param {any} [err] The `error` error.
  77. * @return {Notification<T>} The "error" Notification representing the
  78. * argument.
  79. * @nocollapse
  80. */
  81. static createError<T>(err?: any): Notification<T>;
  82. /**
  83. * A shortcut to create a Notification instance of the type `complete`.
  84. * @return {Notification<any>} The valueless "complete" Notification.
  85. * @nocollapse
  86. */
  87. static createComplete(): Notification<any>;
  88. }