mirror of
https://github.com/re-rxjs/react-rxjs.git
synced 2025-12-08 18:01:51 +00:00
12 lines
355 B
TypeScript
12 lines
355 B
TypeScript
import { ObservableInput, from } from "rxjs"
|
|
import { startWith } from "rxjs/operators"
|
|
import { SUSPENSE } from "../SUSPENSE"
|
|
|
|
/**
|
|
* A RxJS creation operator that prepends a SUSPENSE on the source observable.
|
|
*
|
|
* @param source$ Source observable
|
|
*/
|
|
export const suspend = <T>(source$: ObservableInput<T>) =>
|
|
from(source$).pipe(startWith(SUSPENSE))
|