method_chain.js 555 B

123456789101112131415161718
  1. import {interval} from 'rxjs/observable/interval';
  2. import {filter} from 'rxjs/operator/filter';
  3. import {take} from 'rxjs/operator/take';
  4. import {map} from 'rxjs/operator/map';
  5. import {throttle} from 'rxjs/operator/throttle';
  6. import {takeUntil} from 'rxjs/operator/takeUntil';
  7. function test(observable) {
  8. return observable
  9. ::filter(data => data.someTest)
  10. ::throttle(() =>
  11. interval(10)
  12. ::take(1)
  13. ::takeUntil(observable::filter(data => someOtherTest))
  14. )
  15. ::map(someFunction);
  16. }