rx.experimental.es6.d.ts 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. declare module Rx {
  2. export interface Observable<T> {
  3. /**
  4. * Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
  5. * This operator allows for a fluent style of writing queries that use the same sequence multiple times.
  6. *
  7. * @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
  8. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
  9. */
  10. let<TResult>(selector: (source: Observable<T>) => Observable<TResult>): Observable<TResult>;
  11. }
  12. export interface ObservableStatic {
  13. /**
  14. * Determines whether an observable collection contains values.
  15. *
  16. * @example
  17. * 1 - res = Rx.Observable.if(condition, obs1);
  18. * 2 - res = Rx.Observable.if(condition, obs1, obs2);
  19. * 3 - res = Rx.Observable.if(condition, obs1, scheduler);
  20. * @param {Function} condition The condition which determines if the thenSource or elseSource will be run.
  21. * @param {Observable} thenSource The observable sequence or Promise that will be run if the condition function returns true.
  22. * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
  23. * @returns {Observable} An observable sequence which is either the thenSource or elseSource.
  24. */
  25. if<T>(condition: () => boolean, thenSource: ObservableOrPromise<T>, elseSourceOrScheduler?: ObservableOrPromise<T> | IScheduler): Observable<T>;
  26. }
  27. export interface ObservableStatic {
  28. /**
  29. * Concatenates the observable sequences obtained by running the specified result selector for each element in source.
  30. * There is an alias for this method called 'forIn' for browsers <IE9
  31. * @param {Array} sources An array of values to turn into an observable sequence.
  32. * @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
  33. * @returns {Observable} An observable sequence from the concatenated observable sequences.
  34. */
  35. for<T, TResult>(sources: T[], resultSelector: _Selector<T, TResult>, thisArg?: any): Observable<TResult>;
  36. /**
  37. * Concatenates the observable sequences obtained by running the specified result selector for each element in source.
  38. * There is an alias for this method called 'forIn' for browsers <IE9
  39. * @param {Array} sources An array of values to turn into an observable sequence.
  40. * @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
  41. * @returns {Observable} An observable sequence from the concatenated observable sequences.
  42. */
  43. forIn<T, TResult>(sources: T[], resultSelector: _Selector<T, TResult>, thisArg?: any): Observable<TResult>;
  44. }
  45. export interface ObservableStatic {
  46. /**
  47. * Repeats source as long as condition holds emulating a while loop.
  48. * There is an alias for this method called 'whileDo' for browsers <IE9
  49. *
  50. * @param {Function} condition The condition which determines if the source will be repeated.
  51. * @param {Observable} source The observable sequence that will be run if the condition function returns true.
  52. * @returns {Observable} An observable sequence which is repeated as long as the condition holds.
  53. */
  54. while<T>(condition: () => boolean, source: ObservableOrPromise<T>): Observable<T>;
  55. /**
  56. * Repeats source as long as condition holds emulating a while loop.
  57. * There is an alias for this method called 'whileDo' for browsers <IE9
  58. *
  59. * @param {Function} condition The condition which determines if the source will be repeated.
  60. * @param {Observable} source The observable sequence that will be run if the condition function returns true.
  61. * @returns {Observable} An observable sequence which is repeated as long as the condition holds.
  62. */
  63. whileDo<T>(condition: () => boolean, source: ObservableOrPromise<T>): Observable<T>;
  64. }
  65. export interface Observable<T> {
  66. /**
  67. * Repeats source as long as condition holds emulating a do while loop.
  68. *
  69. * @param {Function} condition The condition which determines if the source will be repeated.
  70. * @param {Observable} source The observable sequence that will be run if the condition function returns true.
  71. * @returns {Observable} An observable sequence which is repeated as long as the condition holds.
  72. */
  73. doWhile(condition: () => boolean): Observable<T>;
  74. }
  75. export interface ObservableStatic {
  76. /**
  77. * Uses selector to determine which source in sources to use.
  78. * @param {Function} selector The function which extracts the value for to test in a case statement.
  79. * @param {Array} sources A object which has keys which correspond to the case statement labels.
  80. * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.
  81. *
  82. * @returns {Observable} An observable sequence which is determined by a case statement.
  83. */
  84. case<T>(selector: () => string, sources: { [key: string]: ObservableOrPromise<T>; }, schedulerOrElseSource?: IScheduler | ObservableOrPromise<T>): Observable<T>;
  85. /**
  86. * Uses selector to determine which source in sources to use.
  87. * @param {Function} selector The function which extracts the value for to test in a case statement.
  88. * @param {Array} sources A object which has keys which correspond to the case statement labels.
  89. * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.
  90. *
  91. * @returns {Observable} An observable sequence which is determined by a case statement.
  92. */
  93. case<T>(selector: () => number, sources: { [key: number]: ObservableOrPromise<T>; }, schedulerOrElseSource?: IScheduler | ObservableOrPromise<T>): Observable<T>;
  94. }
  95. export interface Observable<T> {
  96. /**
  97. * Expands an observable sequence by recursively invoking selector.
  98. *
  99. * @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
  100. * @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
  101. * @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.
  102. */
  103. expand(selector: (item: T) => Observable<T>, scheduler?: IScheduler): Observable<T>;
  104. }
  105. export interface ObservableStatic {
  106. /**
  107. * Runs all observable sequences in parallel and collect their last elements.
  108. *
  109. * @example
  110. * 1 - res = Rx.Observable.forkJoin([obs1, obs2]);
  111. * 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
  112. * @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.
  113. */
  114. forkJoin<T>(sources: ObservableOrPromise<T>[]): Observable<T[]>;
  115. /**
  116. * Runs all observable sequences in parallel and collect their last elements.
  117. *
  118. * @example
  119. * 1 - res = Rx.Observable.forkJoin([obs1, obs2]);
  120. * 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
  121. * @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.
  122. */
  123. forkJoin<T>(...args: ObservableOrPromise<T>[]): Observable<T[]>;
  124. }
  125. export interface Observable<T> {
  126. /**
  127. * Runs two observable sequences in parallel and combines their last elemenets.
  128. *
  129. * @param {Observable} second Second observable sequence.
  130. * @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences.
  131. * @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences.
  132. */
  133. forkJoin<TSecond, TResult>(second: ObservableOrPromise<TSecond>, resultSelector: (left: T, right: TSecond) => TResult): Observable<TResult>;
  134. }
  135. export interface Observable<T> {
  136. /**
  137. * Comonadic bind operator.
  138. * @param {Function} selector A transform function to apply to each element.
  139. * @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
  140. * @returns {Observable} An observable sequence which results from the comonadic bind operation.
  141. */
  142. manySelect<TResult>(selector: _Selector<Observable<T>, TResult>, scheduler?: IScheduler): Observable<TResult>;
  143. /**
  144. * Comonadic bind operator.
  145. * @param {Function} selector A transform function to apply to each element.
  146. * @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
  147. * @returns {Observable} An observable sequence which results from the comonadic bind operation.
  148. */
  149. extend<TResult>(selector: _Selector<Observable<T>, TResult>, scheduler?: IScheduler): Observable<TResult>;
  150. }
  151. export interface Observable<T> {
  152. /**
  153. * Performs a exclusive waiting for the first to finish before subscribing to another observable.
  154. * Observables that come in between subscriptions will be dropped on the floor.
  155. * @returns {Observable} A exclusive observable with only the results that happen when subscribed.
  156. */
  157. switchFirst(): T;
  158. }
  159. export interface Observable<T> {
  160. /**
  161. * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
  162. * transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
  163. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
  164. * @param {Any} [thisArg] Object to use as this when executing callback.
  165. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
  166. * and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
  167. */
  168. selectSwitchFirst<TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TResult>>): Observable<TResult>;
  169. /**
  170. * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
  171. * transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
  172. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
  173. * @param {Any} [thisArg] Object to use as this when executing callback.
  174. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
  175. * and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
  176. */
  177. selectSwitchFirst<TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TResult>>): Observable<TResult>;
  178. /**
  179. * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
  180. * transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
  181. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
  182. * @param {Any} [thisArg] Object to use as this when executing callback.
  183. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
  184. * and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
  185. */
  186. selectSwitchFirst<TOther, TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
  187. /**
  188. * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
  189. * transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
  190. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
  191. * @param {Any} [thisArg] Object to use as this when executing callback.
  192. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
  193. * and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
  194. */
  195. selectSwitchFirst<TOther, TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
  196. /**
  197. * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
  198. * transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
  199. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
  200. * @param {Any} [thisArg] Object to use as this when executing callback.
  201. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
  202. * and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
  203. */
  204. flatMapFirst<TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TResult>>): Observable<TResult>;
  205. /**
  206. * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
  207. * transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
  208. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
  209. * @param {Any} [thisArg] Object to use as this when executing callback.
  210. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
  211. * and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
  212. */
  213. flatMapFirst<TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TResult>>): Observable<TResult>;
  214. /**
  215. * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
  216. * transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
  217. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
  218. * @param {Any} [thisArg] Object to use as this when executing callback.
  219. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
  220. * and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
  221. */
  222. flatMapFirst<TOther, TResult>(selector: _ValueOrSelector<T, ObservableOrPromise<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
  223. /**
  224. * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
  225. * transforms an observable sequence of observable sequences into an observable sequence which performs a exclusive waiting for the first to finish before subscribing to another observable.
  226. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
  227. * @param {Any} [thisArg] Object to use as this when executing callback.
  228. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
  229. * and that at any point in time performs a exclusive waiting for the first to finish before subscribing to another observable.
  230. */
  231. flatMapFirst<TOther, TResult>(selector: _ValueOrSelector<T, ArrayOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
  232. }
  233. export interface Observable<T> {
  234. /**
  235. * One of the Following:
  236. * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
  237. *
  238. * @example
  239. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
  240. * Or:
  241. * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
  242. *
  243. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
  244. * Or:
  245. * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
  246. *
  247. * var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
  248. * @param selector A transform function to apply to each element or an observable sequence to project each element from the
  249. * source sequence onto which could be either an observable or Promise.
  250. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
  251. * @param {Any} [thisArg] Object to use as this when executing callback.
  252. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
  253. */
  254. selectManyWithMaxConcurrent<TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ObservableOrPromise<TResult>>): Observable<TResult>;
  255. /**
  256. * One of the Following:
  257. * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
  258. *
  259. * @example
  260. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
  261. * Or:
  262. * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
  263. *
  264. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
  265. * Or:
  266. * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
  267. *
  268. * var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
  269. * @param selector A transform function to apply to each element or an observable sequence to project each element from the
  270. * source sequence onto which could be either an observable or Promise.
  271. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
  272. * @param {Any} [thisArg] Object to use as this when executing callback.
  273. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
  274. */
  275. selectManyWithMaxConcurrent<TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ArrayOrIterable<TResult>>): Observable<TResult>;
  276. /**
  277. * One of the Following:
  278. * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
  279. *
  280. * @example
  281. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
  282. * Or:
  283. * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
  284. *
  285. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
  286. * Or:
  287. * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
  288. *
  289. * var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
  290. * @param selector A transform function to apply to each element or an observable sequence to project each element from the
  291. * source sequence onto which could be either an observable or Promise.
  292. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
  293. * @param {Any} [thisArg] Object to use as this when executing callback.
  294. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
  295. */
  296. selectManyWithMaxConcurrent<TOther, TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ObservableOrPromise<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
  297. /**
  298. * One of the Following:
  299. * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
  300. *
  301. * @example
  302. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
  303. * Or:
  304. * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
  305. *
  306. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
  307. * Or:
  308. * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
  309. *
  310. * var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
  311. * @param selector A transform function to apply to each element or an observable sequence to project each element from the
  312. * source sequence onto which could be either an observable or Promise.
  313. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
  314. * @param {Any} [thisArg] Object to use as this when executing callback.
  315. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
  316. */
  317. selectManyWithMaxConcurrent<TOther, TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ArrayOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
  318. /**
  319. * One of the Following:
  320. * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
  321. *
  322. * @example
  323. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
  324. * Or:
  325. * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
  326. *
  327. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
  328. * Or:
  329. * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
  330. *
  331. * var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
  332. * @param selector A transform function to apply to each element or an observable sequence to project each element from the
  333. * source sequence onto which could be either an observable or Promise.
  334. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
  335. * @param {Any} [thisArg] Object to use as this when executing callback.
  336. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
  337. */
  338. flatMapWithMaxConcurrent<TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ObservableOrPromise<TResult>>): Observable<TResult>;
  339. /**
  340. * One of the Following:
  341. * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
  342. *
  343. * @example
  344. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
  345. * Or:
  346. * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
  347. *
  348. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
  349. * Or:
  350. * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
  351. *
  352. * var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
  353. * @param selector A transform function to apply to each element or an observable sequence to project each element from the
  354. * source sequence onto which could be either an observable or Promise.
  355. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
  356. * @param {Any} [thisArg] Object to use as this when executing callback.
  357. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
  358. */
  359. flatMapWithMaxConcurrent<TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ArrayOrIterable<TResult>>): Observable<TResult>;
  360. /**
  361. * One of the Following:
  362. * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
  363. *
  364. * @example
  365. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
  366. * Or:
  367. * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
  368. *
  369. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
  370. * Or:
  371. * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
  372. *
  373. * var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
  374. * @param selector A transform function to apply to each element or an observable sequence to project each element from the
  375. * source sequence onto which could be either an observable or Promise.
  376. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
  377. * @param {Any} [thisArg] Object to use as this when executing callback.
  378. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
  379. */
  380. flatMapWithMaxConcurrent<TOther, TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ObservableOrPromise<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
  381. /**
  382. * One of the Following:
  383. * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
  384. *
  385. * @example
  386. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); });
  387. * Or:
  388. * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
  389. *
  390. * var res = source.flatMapWithMaxConcurrent(5, function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
  391. * Or:
  392. * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
  393. *
  394. * var res = source.flatMapWithMaxConcurrent(5, Rx.Observable.fromArray([1,2,3]));
  395. * @param selector A transform function to apply to each element or an observable sequence to project each element from the
  396. * source sequence onto which could be either an observable or Promise.
  397. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
  398. * @param {Any} [thisArg] Object to use as this when executing callback.
  399. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
  400. */
  401. flatMapWithMaxConcurrent<TOther, TResult>(maxConcurrent: number, selector: _ValueOrSelector<T, ArrayOrIterable<TOther>>, resultSelector: special._FlatMapResultSelector<T, TOther, TResult>, thisArg?: any): Observable<TResult>;
  402. }
  403. }
  404. declare module "rx.experimental" { export = Rx; }