This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { EMPTY, Observable, Subscription } from "rxjs"; | |
| import { concatMap, expand, map } from "rxjs/operators"; | |
| import { NotificationQueue } from "rxjs-etc"; | |
| import { get } from "./github"; | |
| function pages<T>( | |
| uri: string, | |
| notifier: Observable<any> | |
| ): Observable<T[]> { | |
| return new Observable<any>(observer => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { EMPTY, Observable } from "rxjs"; | |
| import { expand, map, mergeMap, take } from "rxjs/operators"; | |
| import { get } from "./github"; | |
| function pages<T>( | |
| uri: string, | |
| notifier: Observable<any> | |
| ): Observable<T[]> { | |
| return get<T[]>(uri).pipe( | |
| expand(({ next }) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { EMPTY, Observable, zip } from "rxjs"; | |
| import { expand, map } from "rxjs/operators"; | |
| import { get } from "./github"; | |
| function pages<T>( | |
| uri: string, | |
| notifier: Observable<any> | |
| ): Observable<T[]> { | |
| return get<T[]>(uri).pipe( | |
| expand(({ next }) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { EMPTY, Observable } from "rxjs"; | |
| import { expand, map } from "rxjs/operators"; | |
| import { get } from "./github"; | |
| function pages<T>(uri: string): Observable<T[]> { | |
| return get<T[]>(uri).pipe( | |
| expand(({ next }) => next ? get(next) : EMPTY), | |
| map(({ content }) => content) | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ajax } from "rxjs/ajax"; | |
| import { map } from "rxjs/operators"; | |
| export function get<T>(uri: string): { | |
| content: T, | |
| next: string | |
| } { | |
| return ajax.get(uri).pipe( | |
| map(({ response, xhr }) => ({ | |
| content: response, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { pipe } from "rxjs"; | |
| import { ajax } from "rxjs/ajax" | |
| import { concatMap, filter, ignoreElements } from "rxjs/operators"; | |
| /* ... */ | |
| collection.traverse(pipe( | |
| filter(shouldPut), | |
| concatMap(doc => ajax.put( | |
| `${uri}/docs/${doc.id}`, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Observable, OperatorFunction } from "rxjs"; | |
| /* ... */ | |
| interface Collection { | |
| traverse(): Observable<Document>; | |
| traverse<R>(operator: OperatorFunction<Document, R>): Observable<R>; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Observable, OperatorFunction } from "rxjs"; | |
| /* ... */ | |
| interface Collection { | |
| traverse(): Observable<Document>; | |
| traverse<A>( | |
| op1: OperatorFunction<Document, A>): Observable<A>; | |
| traverse<A, B>( | |
| op1: OperatorFunction<Document, A>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { pipe } from "rxjs"; | |
| import { debounceTime, distinctUntilChanged } from "rxjs/operators"; | |
| const debounceInput = pipe( | |
| debounceTime<string>(400), | |
| distinctUntilChanged() | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Observable } from "rxjs"; | |
| import { debounceTime, distinctUntilChanged } from "rxjs/operators"; | |
| const debounceInput = (changes: Observable<string>) => changes.pipe( | |
| debounceTime(400), | |
| distinctUntilChanged() | |
| ); |