1 | import Observable from './observable'
|
2 | import Stream from './stream'
|
3 | import Property from './property'
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | import never from './primary/never'
|
10 |
|
11 |
|
12 | import later from './time-based/later'
|
13 |
|
14 |
|
15 | import interval from './time-based/interval'
|
16 |
|
17 |
|
18 | import sequentially from './time-based/sequentially'
|
19 |
|
20 |
|
21 | import fromPoll from './time-based/from-poll'
|
22 |
|
23 |
|
24 | import withInterval from './time-based/with-interval'
|
25 |
|
26 |
|
27 | import fromCallback from './primary/from-callback'
|
28 |
|
29 |
|
30 | import fromNodeCallback from './primary/from-node-callback'
|
31 |
|
32 |
|
33 |
|
34 | import fromEvents from './primary/from-events'
|
35 |
|
36 |
|
37 | import stream from './primary/stream'
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | import constant from './primary/constant'
|
44 |
|
45 |
|
46 | import constantError from './primary/constant-error'
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 | import toProperty from './one-source/to-property'
|
53 | Observable.prototype.toProperty = function(fn) {
|
54 | return toProperty(this, fn)
|
55 | }
|
56 |
|
57 |
|
58 | import changes from './one-source/changes'
|
59 | Observable.prototype.changes = function() {
|
60 | return changes(this)
|
61 | }
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | import fromPromise from './interop/from-promise'
|
68 |
|
69 |
|
70 | import toPromise from './interop/to-promise'
|
71 | Observable.prototype.toPromise = function(Promise) {
|
72 | return toPromise(this, Promise)
|
73 | }
|
74 |
|
75 |
|
76 | import fromESObservable from './interop/from-es-observable'
|
77 |
|
78 |
|
79 | import toESObservable from './interop/to-es-observable'
|
80 | Observable.prototype.toESObservable = toESObservable
|
81 | import $$observable from './interop/symbol'
|
82 | Observable.prototype[$$observable] = toESObservable
|
83 |
|
84 | import * as staticLand from './interop/static-land'
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 | import map from './one-source/map'
|
92 | Observable.prototype.map = function(fn) {
|
93 | return map(this, fn)
|
94 | }
|
95 |
|
96 |
|
97 |
|
98 | import filter from './one-source/filter'
|
99 | Observable.prototype.filter = function(fn) {
|
100 | return filter(this, fn)
|
101 | }
|
102 |
|
103 |
|
104 |
|
105 | import take from './one-source/take'
|
106 | Observable.prototype.take = function(n) {
|
107 | return take(this, n)
|
108 | }
|
109 |
|
110 |
|
111 |
|
112 | import takeErrors from './one-source/take-errors'
|
113 | Observable.prototype.takeErrors = function(n) {
|
114 | return takeErrors(this, n)
|
115 | }
|
116 |
|
117 |
|
118 |
|
119 | import takeWhile from './one-source/take-while'
|
120 | Observable.prototype.takeWhile = function(fn) {
|
121 | return takeWhile(this, fn)
|
122 | }
|
123 |
|
124 |
|
125 |
|
126 | import last from './one-source/last'
|
127 | Observable.prototype.last = function() {
|
128 | return last(this)
|
129 | }
|
130 |
|
131 |
|
132 |
|
133 | import skip from './one-source/skip'
|
134 | Observable.prototype.skip = function(n) {
|
135 | return skip(this, n)
|
136 | }
|
137 |
|
138 |
|
139 |
|
140 | import skipWhile from './one-source/skip-while'
|
141 | Observable.prototype.skipWhile = function(fn) {
|
142 | return skipWhile(this, fn)
|
143 | }
|
144 |
|
145 |
|
146 |
|
147 | import skipDuplicates from './one-source/skip-duplicates'
|
148 | Observable.prototype.skipDuplicates = function(fn) {
|
149 | return skipDuplicates(this, fn)
|
150 | }
|
151 |
|
152 |
|
153 |
|
154 | import diff from './one-source/diff'
|
155 | Observable.prototype.diff = function(fn, seed) {
|
156 | return diff(this, fn, seed)
|
157 | }
|
158 |
|
159 |
|
160 | import scan from './one-source/scan'
|
161 | Observable.prototype.scan = function(fn, seed) {
|
162 | return scan(this, fn, seed)
|
163 | }
|
164 |
|
165 |
|
166 |
|
167 | import flatten from './one-source/flatten'
|
168 | Observable.prototype.flatten = function(fn) {
|
169 | return flatten(this, fn)
|
170 | }
|
171 |
|
172 |
|
173 |
|
174 | import delay from './one-source/delay'
|
175 | Observable.prototype.delay = function(wait) {
|
176 | return delay(this, wait)
|
177 | }
|
178 |
|
179 |
|
180 |
|
181 |
|
182 | import throttle from './one-source/throttle'
|
183 | Observable.prototype.throttle = function(wait, options) {
|
184 | return throttle(this, wait, options)
|
185 | }
|
186 |
|
187 |
|
188 |
|
189 |
|
190 | import debounce from './one-source/debounce'
|
191 | Observable.prototype.debounce = function(wait, options) {
|
192 | return debounce(this, wait, options)
|
193 | }
|
194 |
|
195 |
|
196 |
|
197 | import mapErrors from './one-source/map-errors'
|
198 | Observable.prototype.mapErrors = function(fn) {
|
199 | return mapErrors(this, fn)
|
200 | }
|
201 |
|
202 |
|
203 |
|
204 | import filterErrors from './one-source/filter-errors'
|
205 | Observable.prototype.filterErrors = function(fn) {
|
206 | return filterErrors(this, fn)
|
207 | }
|
208 |
|
209 |
|
210 |
|
211 | import ignoreValues from './one-source/ignore-values'
|
212 | Observable.prototype.ignoreValues = function() {
|
213 | return ignoreValues(this)
|
214 | }
|
215 |
|
216 |
|
217 |
|
218 | import ignoreErrors from './one-source/ignore-errors'
|
219 | Observable.prototype.ignoreErrors = function() {
|
220 | return ignoreErrors(this)
|
221 | }
|
222 |
|
223 |
|
224 |
|
225 | import ignoreEnd from './one-source/ignore-end'
|
226 | Observable.prototype.ignoreEnd = function() {
|
227 | return ignoreEnd(this)
|
228 | }
|
229 |
|
230 |
|
231 |
|
232 | import beforeEnd from './one-source/before-end'
|
233 | Observable.prototype.beforeEnd = function(fn) {
|
234 | return beforeEnd(this, fn)
|
235 | }
|
236 |
|
237 |
|
238 |
|
239 | import slidingWindow from './one-source/sliding-window'
|
240 | Observable.prototype.slidingWindow = function(max, min) {
|
241 | return slidingWindow(this, max, min)
|
242 | }
|
243 |
|
244 |
|
245 |
|
246 |
|
247 | import bufferWhile from './one-source/buffer-while'
|
248 | Observable.prototype.bufferWhile = function(fn, options) {
|
249 | return bufferWhile(this, fn, options)
|
250 | }
|
251 |
|
252 |
|
253 |
|
254 | import bufferWithCount from './one-source/buffer-with-count'
|
255 | Observable.prototype.bufferWithCount = function(count, options) {
|
256 | return bufferWithCount(this, count, options)
|
257 | }
|
258 |
|
259 |
|
260 |
|
261 |
|
262 | import bufferWithTimeOrCount from './one-source/buffer-with-time-or-count'
|
263 | Observable.prototype.bufferWithTimeOrCount = function(wait, count, options) {
|
264 | return bufferWithTimeOrCount(this, wait, count, options)
|
265 | }
|
266 |
|
267 |
|
268 |
|
269 | import transduce from './one-source/transduce'
|
270 | Observable.prototype.transduce = function(transducer) {
|
271 | return transduce(this, transducer)
|
272 | }
|
273 |
|
274 |
|
275 |
|
276 | import withHandler from './one-source/with-handler'
|
277 | Observable.prototype.withHandler = function(fn) {
|
278 | return withHandler(this, fn)
|
279 | }
|
280 |
|
281 |
|
282 |
|
283 | Observable.prototype.thru = function(fn) {
|
284 | return fn(this)
|
285 | }
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 | import combine from './many-sources/combine'
|
293 | Observable.prototype.combine = function(other, combinator) {
|
294 | return combine([this, other], combinator)
|
295 | }
|
296 |
|
297 |
|
298 | import zip from './many-sources/zip'
|
299 | Observable.prototype.zip = function(other, combinator) {
|
300 | return zip([this, other], combinator)
|
301 | }
|
302 |
|
303 |
|
304 | import merge from './many-sources/merge'
|
305 | Observable.prototype.merge = function(other) {
|
306 | return merge([this, other])
|
307 | }
|
308 |
|
309 |
|
310 | import concat from './many-sources/concat'
|
311 | Observable.prototype.concat = function(other) {
|
312 | return concat([this, other])
|
313 | }
|
314 |
|
315 |
|
316 | import Pool from './many-sources/pool'
|
317 | const pool = function() {
|
318 | return new Pool()
|
319 | }
|
320 |
|
321 |
|
322 | import repeat from './many-sources/repeat'
|
323 |
|
324 |
|
325 |
|
326 | import FlatMap from './many-sources/flat-map'
|
327 | Observable.prototype.flatMap = function(fn) {
|
328 | return new FlatMap(this, fn).setName(this, 'flatMap')
|
329 | }
|
330 | Observable.prototype.flatMapLatest = function(fn) {
|
331 | return new FlatMap(this, fn, {concurLim: 1, drop: 'old'}).setName(this, 'flatMapLatest')
|
332 | }
|
333 | Observable.prototype.flatMapFirst = function(fn) {
|
334 | return new FlatMap(this, fn, {concurLim: 1}).setName(this, 'flatMapFirst')
|
335 | }
|
336 | Observable.prototype.flatMapConcat = function(fn) {
|
337 | return new FlatMap(this, fn, {queueLim: -1, concurLim: 1}).setName(this, 'flatMapConcat')
|
338 | }
|
339 | Observable.prototype.flatMapConcurLimit = function(fn, limit) {
|
340 | return new FlatMap(this, fn, {queueLim: -1, concurLim: limit}).setName(this, 'flatMapConcurLimit')
|
341 | }
|
342 |
|
343 |
|
344 | import FlatMapErrors from './many-sources/flat-map-errors'
|
345 | Observable.prototype.flatMapErrors = function(fn) {
|
346 | return new FlatMapErrors(this, fn).setName(this, 'flatMapErrors')
|
347 | }
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 | import filterBy from './two-sources/filter-by'
|
355 | Observable.prototype.filterBy = function(other) {
|
356 | return filterBy(this, other)
|
357 | }
|
358 |
|
359 |
|
360 |
|
361 | import sampledBy2items from './two-sources/sampled-by'
|
362 | Observable.prototype.sampledBy = function(other, combinator) {
|
363 | return sampledBy2items(this, other, combinator)
|
364 | }
|
365 |
|
366 |
|
367 |
|
368 | import skipUntilBy from './two-sources/skip-until-by'
|
369 | Observable.prototype.skipUntilBy = function(other) {
|
370 | return skipUntilBy(this, other)
|
371 | }
|
372 |
|
373 |
|
374 |
|
375 | import takeUntilBy from './two-sources/take-until-by'
|
376 | Observable.prototype.takeUntilBy = function(other) {
|
377 | return takeUntilBy(this, other)
|
378 | }
|
379 |
|
380 |
|
381 |
|
382 |
|
383 | import bufferBy from './two-sources/buffer-by'
|
384 | Observable.prototype.bufferBy = function(other, options) {
|
385 | return bufferBy(this, other, options)
|
386 | }
|
387 |
|
388 |
|
389 |
|
390 |
|
391 | import bufferWhileBy from './two-sources/buffer-while-by'
|
392 | Observable.prototype.bufferWhileBy = function(other, options) {
|
393 | return bufferWhileBy(this, other, options)
|
394 | }
|
395 |
|
396 |
|
397 |
|
398 |
|
399 | let DEPRECATION_WARNINGS = true
|
400 | export function dissableDeprecationWarnings() {
|
401 | DEPRECATION_WARNINGS = false
|
402 | }
|
403 |
|
404 | function warn(msg) {
|
405 | if (DEPRECATION_WARNINGS && console && typeof console.warn === 'function') {
|
406 | const msg2 = '\nHere is an Error object for you containing the call stack:'
|
407 | console.warn(msg, msg2, new Error())
|
408 | }
|
409 | }
|
410 |
|
411 |
|
412 | import awaiting from './two-sources/awaiting'
|
413 | Observable.prototype.awaiting = function(other) {
|
414 | warn('You are using deprecated .awaiting() method, see https://github.com/kefirjs/kefir/issues/145')
|
415 | return awaiting(this, other)
|
416 | }
|
417 |
|
418 |
|
419 |
|
420 | import valuesToErrors from './one-source/values-to-errors'
|
421 | Observable.prototype.valuesToErrors = function(fn) {
|
422 | warn('You are using deprecated .valuesToErrors() method, see https://github.com/kefirjs/kefir/issues/149')
|
423 | return valuesToErrors(this, fn)
|
424 | }
|
425 |
|
426 |
|
427 |
|
428 | import errorsToValues from './one-source/errors-to-values'
|
429 | Observable.prototype.errorsToValues = function(fn) {
|
430 | warn('You are using deprecated .errorsToValues() method, see https://github.com/kefirjs/kefir/issues/149')
|
431 | return errorsToValues(this, fn)
|
432 | }
|
433 |
|
434 |
|
435 |
|
436 | import endOnError from './one-source/end-on-error'
|
437 | Observable.prototype.endOnError = function() {
|
438 | warn('You are using deprecated .endOnError() method, see https://github.com/kefirjs/kefir/issues/150')
|
439 | return endOnError(this)
|
440 | }
|
441 |
|
442 |
|
443 |
|
444 |
|
445 | const Kefir = {
|
446 | Observable,
|
447 | Stream,
|
448 | Property,
|
449 | never,
|
450 | later,
|
451 | interval,
|
452 | sequentially,
|
453 | fromPoll,
|
454 | withInterval,
|
455 | fromCallback,
|
456 | fromNodeCallback,
|
457 | fromEvents,
|
458 | stream,
|
459 | constant,
|
460 | constantError,
|
461 | fromPromise,
|
462 | fromESObservable,
|
463 | combine,
|
464 | zip,
|
465 | merge,
|
466 | concat,
|
467 | Pool,
|
468 | pool,
|
469 | repeat,
|
470 | staticLand,
|
471 | }
|
472 |
|
473 | Kefir.Kefir = Kefir
|
474 |
|
475 | export {
|
476 | Kefir,
|
477 | Observable,
|
478 | Stream,
|
479 | Property,
|
480 | never,
|
481 | later,
|
482 | interval,
|
483 | sequentially,
|
484 | fromPoll,
|
485 | withInterval,
|
486 | fromCallback,
|
487 | fromNodeCallback,
|
488 | fromEvents,
|
489 | stream,
|
490 | constant,
|
491 | constantError,
|
492 | fromPromise,
|
493 | fromESObservable,
|
494 | combine,
|
495 | zip,
|
496 | merge,
|
497 | concat,
|
498 | Pool,
|
499 | pool,
|
500 | repeat,
|
501 | staticLand,
|
502 | }
|
503 |
|
504 | export default Kefir
|