aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/helpers/rxjs.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-14 11:50:22 +0200
committerChocobozzz <me@florianbigard.com>2021-10-14 11:50:22 +0200
commitafb7d2d5c6ca09d2c678781ae4dd3f527604c1b4 (patch)
treee0b9c2039c541f5866c596b1531f820fc938ca50 /client/src/app/helpers/rxjs.ts
parent37cd44d04f2ad4d90535d28340c78d8d85b31f18 (diff)
downloadPeerTube-afb7d2d5c6ca09d2c678781ae4dd3f527604c1b4.tar.gz
PeerTube-afb7d2d5c6ca09d2c678781ae4dd3f527604c1b4.tar.zst
PeerTube-afb7d2d5c6ca09d2c678781ae4dd3f527604c1b4.zip
Remove protractor workaround
We don't use it anymore
Diffstat (limited to 'client/src/app/helpers/rxjs.ts')
-rw-r--r--client/src/app/helpers/rxjs.ts13
1 files changed, 4 insertions, 9 deletions
diff --git a/client/src/app/helpers/rxjs.ts b/client/src/app/helpers/rxjs.ts
index eb051f868..625bca0f7 100644
--- a/client/src/app/helpers/rxjs.ts
+++ b/client/src/app/helpers/rxjs.ts
@@ -1,24 +1,19 @@
1import { uniq } from 'lodash-es' 1import { uniq } from 'lodash-es'
2import { asyncScheduler, Observable } from 'rxjs' 2import { Observable } from 'rxjs'
3import { bufferTime, distinctUntilChanged, filter, map, observeOn, share, switchMap } from 'rxjs/operators' 3import { bufferTime, distinctUntilChanged, filter, map, share, switchMap } from 'rxjs/operators'
4import { NgZone } from '@angular/core'
5import { enterZone, leaveZone } from './zone'
6 4
7function buildBulkObservable <T extends number | string, R> (options: { 5function buildBulkObservable <T extends number | string, R> (options: {
8 ngZone: NgZone
9 notifierObservable: Observable<T> 6 notifierObservable: Observable<T>
10 time: number 7 time: number
11 bulkGet: (params: T[]) => Observable<R> 8 bulkGet: (params: T[]) => Observable<R>
12}) { 9}) {
13 const { ngZone, notifierObservable, time, bulkGet } = options 10 const { notifierObservable, time, bulkGet } = options
14 11
15 return notifierObservable.pipe( 12 return notifierObservable.pipe(
16 distinctUntilChanged(), 13 distinctUntilChanged(),
17 // We leave Angular zone so Protractor does not get stuck 14 bufferTime(time),
18 bufferTime(time, leaveZone(ngZone, asyncScheduler)),
19 filter(params => params.length !== 0), 15 filter(params => params.length !== 0),
20 map(params => uniq(params)), 16 map(params => uniq(params)),
21 observeOn(enterZone(ngZone, asyncScheduler)),
22 switchMap(params => bulkGet(params)), 17 switchMap(params => bulkGet(params)),
23 share() 18 share()
24 ) 19 )