PairsObservable.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { IScheduler } from '../Scheduler';
  2. import { Observable } from '../Observable';
  3. import { Subscriber } from '../Subscriber';
  4. import { TeardownLogic } from '../Subscription';
  5. /**
  6. * We need this JSDoc comment for affecting ESDoc.
  7. * @extends {Ignored}
  8. * @hide true
  9. */
  10. export declare class PairsObservable<T> extends Observable<Array<string | T>> {
  11. private obj;
  12. private scheduler;
  13. private keys;
  14. /**
  15. * Convert an object into an observable sequence of [key, value] pairs
  16. * using an optional IScheduler to enumerate the object.
  17. *
  18. * @example <caption>Converts a javascript object to an Observable</caption>
  19. * var obj = {
  20. * foo: 42,
  21. * bar: 56,
  22. * baz: 78
  23. * };
  24. *
  25. * var source = Rx.Observable.pairs(obj);
  26. *
  27. * var subscription = source.subscribe(
  28. * function (x) {
  29. * console.log('Next: %s', x);
  30. * },
  31. * function (err) {
  32. * console.log('Error: %s', err);
  33. * },
  34. * function () {
  35. * console.log('Completed');
  36. * });
  37. *
  38. * @param {Object} obj The object to inspect and turn into an
  39. * Observable sequence.
  40. * @param {Scheduler} [scheduler] An optional IScheduler to run the
  41. * enumeration of the input sequence on.
  42. * @returns {(Observable<Array<string | T>>)} An observable sequence of
  43. * [key, value] pairs from the object.
  44. */
  45. static create<T>(obj: Object, scheduler?: IScheduler): Observable<Array<string | T>>;
  46. constructor(obj: Object, scheduler?: IScheduler);
  47. /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<Array<string | T>>): TeardownLogic;
  48. }