chore: add prettier and reformat lib

This commit is contained in:
waterplea
2022-07-24 17:53:24 +03:00
committed by Matt Hill
parent c7006e0eb2
commit 2fef1e572c
12 changed files with 2600 additions and 112 deletions

View File

@@ -1,5 +1,13 @@
import { BehaviorSubject, concat, from, Observable, of } from 'rxjs'
import { concatMap, delay, map, skip, switchMap, take, tap } from 'rxjs/operators'
import {
concatMap,
delay,
map,
skip,
switchMap,
take,
tap,
} from 'rxjs/operators'
import { Store } from '../store'
import { Http, Update } from '../types'
import { Source } from './source'
@@ -10,17 +18,15 @@ export type PollConfig = {
}
export class PollSource<T> implements Source<T> {
constructor (
constructor(
private readonly pollConfig: PollConfig,
private readonly http: Http<T>,
) { }
) {}
watch$ (store: Store<T>): Observable<RPCResponse<Update<T>>> {
watch$(store: Store<T>): Observable<RPCResponse<Update<T>>> {
const polling$ = new BehaviorSubject('')
const updates$ = of({ })
.pipe(
const updates$ = of({}).pipe(
concatMap(_ => store.sequence$),
concatMap(seq => this.http.getRevisions(seq)),
take(1),
@@ -43,8 +49,7 @@ export class PollSource<T> implements Source<T> {
return of(res) // takes Dump<T> and converts it into Observable<Dump<T>>
}
}),
map(result => ({ result,
jsonrpc: '2.0' })),
map(result => ({ result, jsonrpc: '2.0' })),
)
}
}