rx.joinpatterns.es6.d.ts 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. declare module Rx {
  2. export class Plan<T> { }
  3. export interface Pattern2<T1, T2> {
  4. /**
  5. * Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
  6. * @param other Observable sequence to match in addition to the current pattern.
  7. * @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
  8. */
  9. and<T3>(other: Observable<T3>): Pattern3<T1, T2, T3>;
  10. /**
  11. * Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
  12. * @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
  13. * @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
  14. */
  15. thenDo<TR>(selector: (item1: T1, item2: T2) => TR): Plan<TR>;
  16. }
  17. interface Pattern3<T1, T2, T3> {
  18. /**
  19. * Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
  20. * @param other Observable sequence to match in addition to the current pattern.
  21. * @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
  22. */
  23. and<T4>(other: Observable<T4>): Pattern4<T1, T2, T3, T4>;
  24. /**
  25. * Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
  26. * @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
  27. * @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
  28. */
  29. thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3) => TR): Plan<TR>;
  30. }
  31. interface Pattern4<T1, T2, T3, T4> {
  32. /**
  33. * Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
  34. * @param other Observable sequence to match in addition to the current pattern.
  35. * @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
  36. */
  37. and<T5>(other: Observable<T5>): Pattern5<T1, T2, T3, T4, T5>;
  38. /**
  39. * Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
  40. * @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
  41. * @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
  42. */
  43. thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4) => TR): Plan<TR>;
  44. }
  45. interface Pattern5<T1, T2, T3, T4, T5> {
  46. /**
  47. * Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
  48. * @param other Observable sequence to match in addition to the current pattern.
  49. * @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
  50. */
  51. and<T6>(other: Observable<T6>): Pattern6<T1, T2, T3, T4, T5, T6>;
  52. /**
  53. * Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
  54. * @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
  55. * @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
  56. */
  57. thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5) => TR): Plan<TR>;
  58. }
  59. interface Pattern6<T1, T2, T3, T4, T5, T6> {
  60. /**
  61. * Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
  62. * @param other Observable sequence to match in addition to the current pattern.
  63. * @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
  64. */
  65. and<T7>(other: Observable<T7>): Pattern7<T1, T2, T3, T4, T5, T6, T7>;
  66. /**
  67. * Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
  68. * @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
  69. * @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
  70. */
  71. thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6) => TR): Plan<TR>;
  72. }
  73. interface Pattern7<T1, T2, T3, T4, T5, T6, T7> {
  74. /**
  75. * Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
  76. * @param other Observable sequence to match in addition to the current pattern.
  77. * @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
  78. */
  79. and<T8>(other: Observable<T8>): Pattern8<T1, T2, T3, T4, T5, T6, T7, T8>;
  80. /**
  81. * Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
  82. * @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
  83. * @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
  84. */
  85. thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6, item7: T7) => TR): Plan<TR>;
  86. }
  87. interface Pattern8<T1, T2, T3, T4, T5, T6, T7, T8> {
  88. /**
  89. * Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
  90. * @param other Observable sequence to match in addition to the current pattern.
  91. * @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
  92. */
  93. and<T9>(other: Observable<T9>): Pattern9<T1, T2, T3, T4, T5, T6, T7, T8, T9>;
  94. /**
  95. * Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
  96. * @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
  97. * @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
  98. */
  99. thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6, item7: T7, item8: T8) => TR): Plan<TR>;
  100. }
  101. interface Pattern9<T1, T2, T3, T4, T5, T6, T7, T8, T9> {
  102. /**
  103. * Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
  104. * @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
  105. * @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
  106. */
  107. thenDo<TR>(selector: (item1: T1, item2: T2, item3: T3, item4: T4, item5: T5, item6: T6, item7: T7, item8: T8, item9: T9) => TR): Plan<TR>;
  108. }
  109. export interface Observable<T> {
  110. /**
  111. * Creates a pattern that matches when both observable sequences have an available value.
  112. *
  113. * @param right Observable sequence to match with the current sequence.
  114. * @return {Pattern} Pattern object that matches when both observable sequences have an available value.
  115. */
  116. and<T2>(right: Observable<T2>): Pattern2<T, T2>;
  117. }
  118. export interface Observable<T> {
  119. /**
  120. * Matches when the observable sequence has an available value and projects the value.
  121. *
  122. * @param {Function} selector Selector that will be invoked for values in the source sequence.
  123. * @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
  124. */
  125. thenDo<TR>(selector: (item1: T) => TR): Plan<TR>;
  126. }
  127. export interface ObservableStatic {
  128. /**
  129. * Joins together the results from several patterns.
  130. *
  131. * @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.
  132. * @returns {Observable} Observable sequence with the results form matching several patterns.
  133. */
  134. when<TR>(plan: Plan<TR>): Observable<TR>;
  135. }
  136. }
  137. declare module "rx.joinpatterns" { export = Rx; }